Added maxTextureLayers to caps/limits.

This commit is contained in:
Branimir Karadžić 2018-02-08 16:48:54 -08:00
parent 633d15cde3
commit 8adb5fc020
9 changed files with 44 additions and 3 deletions

View File

@ -614,6 +614,7 @@ namespace bgfx
uint32_t maxDrawCalls; //!< Maximum number of draw calls.
uint32_t maxBlits; //!< Maximum number of blit calls.
uint32_t maxTextureSize; //!< Maximum texture size.
uint32_t maxTextureLayers; //!< Maximum texture layers.
uint32_t maxViews; //!< Maximum number of views.
uint32_t maxFrameBuffers; //!< Maximum number of frame buffer handles.
uint32_t maxFBAttachments; //!< Maximum number of frame buffer attachments.

View File

@ -495,6 +495,7 @@ typedef struct bgfx_caps_limits
uint32_t maxDrawCalls;
uint32_t maxBlits;
uint32_t maxTextureSize;
uint32_t maxTextureLayers;
uint32_t maxViews;
uint32_t maxFrameBuffers;
uint32_t maxFBAttachments;

View File

@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(60)
#define BGFX_API_VERSION UINT32_C(61)
/// Color RGB/alpha/depth write. When it's not specified write will be disabled.
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.

View File

@ -1249,6 +1249,7 @@ namespace bgfx
LIMITS(maxDrawCalls);
LIMITS(maxBlits);
LIMITS(maxTextureSize);
LIMITS(maxTextureLayers);
LIMITS(maxViews);
LIMITS(maxFrameBuffers);
LIMITS(maxFBAttachments);
@ -2805,6 +2806,8 @@ namespace bgfx
bx::memSet(&g_caps, 0, sizeof(g_caps) );
g_caps.limits.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
g_caps.limits.maxBlits = BGFX_CONFIG_MAX_BLIT_ITEMS;
g_caps.limits.maxTextureSize = 0;
g_caps.limits.maxTextureLayers = 1;
g_caps.limits.maxViews = BGFX_CONFIG_MAX_VIEWS;
g_caps.limits.maxFrameBuffers = BGFX_CONFIG_MAX_FRAME_BUFFERS;
g_caps.limits.maxPrograms = BGFX_CONFIG_MAX_PROGRAMS;

View File

@ -1537,6 +1537,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
g_caps.supported |= BGFX_CAPS_TEXTURE_COMPARE_ALL;
g_caps.limits.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
g_caps.limits.maxTextureLayers = D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(
D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT
, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS

View File

@ -1277,7 +1277,8 @@ namespace bgfx { namespace d3d12
| BGFX_CAPS_TEXTURE_2D_ARRAY
| BGFX_CAPS_TEXTURE_CUBE_ARRAY
);
g_caps.limits.maxTextureSize = 16384;
g_caps.limits.maxTextureSize = D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION;
g_caps.limits.maxTextureLayers = D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS;

View File

@ -2316,7 +2316,8 @@ namespace bgfx { namespace gl
: 0
;
g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
g_caps.limits.maxTextureLayers = uint16_t(bx::max(glGet(GL_MAX_ARRAY_TEXTURE_LAYERS), 1) );
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)

View File

@ -525,6 +525,10 @@ typedef uint64_t GLuint64;
# define GL_MAX_DRAW_BUFFERS 0x8824
#endif // GL_MAX_DRAW_BUFFERS
#ifndef GL_MAX_ARRAY_TEXTURE_LAYERS
# define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
#endif // GL_MAX_ARRAY_TEXTURE_LAYERS
#ifndef GL_QUERY_RESULT
# define GL_QUERY_RESULT 0x8866
#endif // GL_QUERY_RESULT

View File

@ -38,6 +38,35 @@ namespace bgfx { namespace noop
| BGFX_CAPS_VERTEX_ATTRIB_HALF
| BGFX_CAPS_VERTEX_ATTRIB_UINT10
;
// Pretend all features are available for all texture formats.
for (uint32_t formatIdx = 0; formatIdx < TextureFormat::Count; ++formatIdx)
{
g_caps.formats[formatIdx] = 0
| BGFX_CAPS_FORMAT_TEXTURE_NONE
| BGFX_CAPS_FORMAT_TEXTURE_2D
| BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB
| BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED
| BGFX_CAPS_FORMAT_TEXTURE_3D
| BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB
| BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED
| BGFX_CAPS_FORMAT_TEXTURE_CUBE
| BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB
| BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED
| BGFX_CAPS_FORMAT_TEXTURE_VERTEX
| BGFX_CAPS_FORMAT_TEXTURE_IMAGE
| BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER
| BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA
| BGFX_CAPS_FORMAT_TEXTURE_MSAA
| BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN
;
}
// Pretend we have no limits
g_caps.limits.maxTextureSize = 16384;
g_caps.limits.maxTextureLayers = 2048;
g_caps.limits.maxFBAttachments = BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS;
g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS;
}
~RendererContextNOOP()