mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Added limits info to caps.
This commit is contained in:
@@ -97,7 +97,7 @@ class ExampleDrawStress : public entry::AppI
|
||||
bgfx::reset(m_width, m_height, m_reset);
|
||||
|
||||
const bgfx::Caps* caps = bgfx::getCaps();
|
||||
m_maxDim = (int32_t)powf(float(caps->maxDrawCalls), 1.0f/3.0f);
|
||||
m_maxDim = (int32_t)bx::fpow(float(caps->limits.maxDrawCalls), 1.0f/3.0f);
|
||||
|
||||
// Enable debug text.
|
||||
bgfx::setDebug(m_debug);
|
||||
|
||||
@@ -393,7 +393,7 @@ class ExampleDeferred : public entry::AppI
|
||||
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: MRT rendering and deferred shading.");
|
||||
bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs);
|
||||
|
||||
if (2 > m_caps->maxFBAttachments)
|
||||
if (2 > m_caps->limits.maxFBAttachments)
|
||||
{
|
||||
// When multiple render targets (MRT) is not supported by GPU,
|
||||
// implement alternative code path that doesn't use MRT.
|
||||
|
||||
@@ -520,15 +520,11 @@ namespace bgfx
|
||||
///
|
||||
uint64_t supported;
|
||||
|
||||
uint32_t maxDrawCalls; //!< Maximum draw calls.
|
||||
uint16_t maxTextureSize; //!< Maximum texture size.
|
||||
uint16_t maxViews; //!< Maximum views.
|
||||
uint8_t maxFBAttachments; //!< Maximum frame buffer attachments.
|
||||
uint8_t numGPUs; //!< Number of enumerated GPUs.
|
||||
uint16_t vendorId; //!< Selected GPU vendor id.
|
||||
uint16_t deviceId; //!< Selected GPU device id.
|
||||
bool homogeneousDepth; //!< True when NDC depth is in [-1, 1] range.
|
||||
bool originBottomLeft; //!< True when NDC origin is at bottom left.
|
||||
uint8_t numGPUs; //!< Number of enumerated GPUs.
|
||||
|
||||
/// GPU info.
|
||||
///
|
||||
@@ -542,6 +538,30 @@ namespace bgfx
|
||||
|
||||
GPU gpu[4]; //!< Enumerated GPUs.
|
||||
|
||||
struct Limits
|
||||
{
|
||||
uint32_t maxDrawCalls; //!< Maximum draw calls.
|
||||
uint32_t maxBlits; //!<
|
||||
uint32_t maxTextureSize; //!< Maximum texture size.
|
||||
uint32_t maxViews; //!< Maximum views.
|
||||
uint32_t maxFrameBuffers; //!<
|
||||
uint32_t maxFBAttachments; //!< Maximum frame buffer attachments.
|
||||
uint32_t maxPrograms; //!<
|
||||
uint32_t maxShaders; //!<
|
||||
uint32_t maxTextures; //!<
|
||||
uint32_t maxTextureSamplers; //!<
|
||||
uint32_t maxVertexDecls; //!<
|
||||
uint32_t maxVertexStreams; //!<
|
||||
uint32_t maxIndexBuffers; //!<
|
||||
uint32_t maxVertexBuffers; //!<
|
||||
uint32_t maxDynamicIndexBuffers; //!<
|
||||
uint32_t maxDynamicVertexBuffers; //!<
|
||||
uint32_t maxUniforms; //!<
|
||||
uint32_t maxOcclusionQueries; //!<
|
||||
};
|
||||
|
||||
Limits limits;
|
||||
|
||||
/// Supported texture formats.
|
||||
/// - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported.
|
||||
/// - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
||||
#define BGFX_DEFINES_H_HEADER_GUARD
|
||||
|
||||
#define BGFX_API_VERSION UINT32_C(20)
|
||||
#define BGFX_API_VERSION UINT32_C(21)
|
||||
|
||||
///
|
||||
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
|
||||
|
||||
@@ -406,6 +406,29 @@ typedef struct bgfx_caps_gpu
|
||||
|
||||
} bgfx_caps_gpu_t;
|
||||
|
||||
typedef struct bgfx_caps_limits
|
||||
{
|
||||
uint32_t maxDrawCalls;
|
||||
uint32_t maxBlits;
|
||||
uint32_t maxTextureSize;
|
||||
uint32_t maxViews;
|
||||
uint32_t maxFrameBuffers;
|
||||
uint32_t maxFBAttachments;
|
||||
uint32_t maxPrograms;
|
||||
uint32_t maxShaders;
|
||||
uint32_t maxTextures;
|
||||
uint32_t maxTextureSamplers;
|
||||
uint32_t maxVertexDecls;
|
||||
uint32_t maxVertexStreams;
|
||||
uint32_t maxIndexBuffers;
|
||||
uint32_t maxVertexBuffers;
|
||||
uint32_t maxDynamicIndexBuffers;
|
||||
uint32_t maxDynamicVertexBuffers;
|
||||
uint32_t maxUniforms;
|
||||
uint32_t maxOcclusionQueries;
|
||||
|
||||
} bgfx_caps_limits_t;
|
||||
|
||||
/**/
|
||||
typedef struct bgfx_caps
|
||||
{
|
||||
@@ -413,17 +436,14 @@ typedef struct bgfx_caps
|
||||
|
||||
uint64_t supported;
|
||||
|
||||
uint32_t maxDrawCalls;
|
||||
uint16_t maxTextureSize;
|
||||
uint16_t maxViews;
|
||||
uint8_t maxFBAttachments;
|
||||
uint8_t numGPUs;
|
||||
uint16_t vendorId;
|
||||
uint16_t deviceId;
|
||||
bool homogeneousDepth;
|
||||
bool originBottomLeft;
|
||||
uint8_t numGPUs;
|
||||
|
||||
bgfx_caps_gpu_t gpu[4];
|
||||
bgfx_caps_limits_t limits;
|
||||
|
||||
uint16_t formats[BGFX_TEXTURE_FORMAT_COUNT];
|
||||
|
||||
|
||||
70
src/bgfx.cpp
70
src/bgfx.cpp
@@ -689,7 +689,7 @@ namespace bgfx
|
||||
Mem(fs_clear7_dx9, sizeof(fs_clear7_dx9) ),
|
||||
};
|
||||
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
|
||||
}
|
||||
@@ -711,7 +711,7 @@ namespace bgfx
|
||||
Mem(fs_clear7_dx11, sizeof(fs_clear7_dx11) ),
|
||||
};
|
||||
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
|
||||
}
|
||||
@@ -734,7 +734,7 @@ namespace bgfx
|
||||
Mem(fs_clear7_glsl, sizeof(fs_clear7_glsl) ),
|
||||
};
|
||||
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
|
||||
}
|
||||
@@ -755,7 +755,7 @@ namespace bgfx
|
||||
Mem(fs_clear7_mtl, sizeof(fs_clear7_mtl) ),
|
||||
};
|
||||
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
|
||||
}
|
||||
@@ -765,7 +765,7 @@ namespace bgfx
|
||||
BGFX_FATAL(false, Fatal::UnableToInitialize, "Unknown renderer type %d", g_caps.rendererType);
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
ShaderHandle fsh = createShader(fragMem[ii]);
|
||||
m_program[ii] = createProgram(vsh, fsh);
|
||||
@@ -785,7 +785,7 @@ namespace bgfx
|
||||
|
||||
if (RendererType::Null != g_caps.rendererType)
|
||||
{
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
if (isValid(m_program[ii]) )
|
||||
{
|
||||
@@ -1121,6 +1121,7 @@ namespace bgfx
|
||||
|
||||
static void dumpCaps()
|
||||
{
|
||||
BX_TRACE("");
|
||||
BX_TRACE("Sort key masks:");
|
||||
BX_TRACE("\t View %016" PRIx64, SORT_KEY_VIEW_MASK);
|
||||
BX_TRACE("\t Draw bit %016" PRIx64, SORT_KEY_DRAW_BIT);
|
||||
@@ -1130,6 +1131,7 @@ namespace bgfx
|
||||
BX_TRACE("\tC Program %016" PRIx64, SORT_KEY_COMPUTE_PROGRAM_MASK);
|
||||
BX_TRACE("\tD Depth %016" PRIx64, SORT_KEY_DRAW_DEPTH_MASK);
|
||||
|
||||
BX_TRACE("");
|
||||
BX_TRACE("Supported capabilities (renderer %s, vendor 0x%04x, device 0x%04x):"
|
||||
, s_ctx->m_renderCtx->getRendererName()
|
||||
, g_caps.vendorId
|
||||
@@ -1143,6 +1145,30 @@ namespace bgfx
|
||||
}
|
||||
}
|
||||
|
||||
BX_TRACE("");
|
||||
BX_TRACE("Limits:");
|
||||
#define LIMITS(_x) BX_TRACE("\t%-24s %d", #_x, g_caps.limits._x)
|
||||
LIMITS(maxDrawCalls);
|
||||
LIMITS(maxBlits);
|
||||
LIMITS(maxTextureSize);
|
||||
LIMITS(maxViews);
|
||||
LIMITS(maxFrameBuffers);
|
||||
LIMITS(maxFBAttachments);
|
||||
LIMITS(maxPrograms);
|
||||
LIMITS(maxShaders);
|
||||
LIMITS(maxTextures);
|
||||
LIMITS(maxTextureSamplers);
|
||||
LIMITS(maxVertexDecls);
|
||||
LIMITS(maxVertexStreams);
|
||||
LIMITS(maxIndexBuffers);
|
||||
LIMITS(maxVertexBuffers);
|
||||
LIMITS(maxDynamicIndexBuffers);
|
||||
LIMITS(maxDynamicVertexBuffers);
|
||||
LIMITS(maxUniforms);
|
||||
LIMITS(maxOcclusionQueries);
|
||||
#undef LIMITS
|
||||
|
||||
BX_TRACE("");
|
||||
BX_TRACE("Supported texture formats:");
|
||||
BX_TRACE("\t +---------------- 2D: x = supported / * = emulated");
|
||||
BX_TRACE("\t |+--------------- 2D: sRGB format");
|
||||
@@ -1182,11 +1208,13 @@ namespace bgfx
|
||||
}
|
||||
}
|
||||
|
||||
BX_TRACE("Max FB attachments: %d", g_caps.maxFBAttachments);
|
||||
BX_TRACE("");
|
||||
BX_TRACE("NDC depth [%d, 1], origin %s left."
|
||||
, g_caps.homogeneousDepth ? -1 : 0
|
||||
, g_caps.originBottomLeft ? "bottom" : "top"
|
||||
);
|
||||
|
||||
BX_TRACE("");
|
||||
}
|
||||
|
||||
TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer)
|
||||
@@ -2470,9 +2498,24 @@ namespace bgfx
|
||||
}
|
||||
|
||||
memset(&g_caps, 0, sizeof(g_caps) );
|
||||
g_caps.maxViews = BGFX_CONFIG_MAX_VIEWS;
|
||||
g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
|
||||
g_caps.maxFBAttachments = 1;
|
||||
g_caps.limits.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
|
||||
g_caps.limits.maxBlits = BGFX_CONFIG_MAX_BLIT_ITEMS;
|
||||
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;
|
||||
g_caps.limits.maxShaders = BGFX_CONFIG_MAX_SHADERS;
|
||||
g_caps.limits.maxTextures = BGFX_CONFIG_MAX_TEXTURES;
|
||||
g_caps.limits.maxTextureSamplers = BGFX_CONFIG_MAX_TEXTURE_SAMPLERS;
|
||||
g_caps.limits.maxVertexDecls = BGFX_CONFIG_MAX_VERTEX_DECLS;
|
||||
g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS;
|
||||
g_caps.limits.maxIndexBuffers = BGFX_CONFIG_MAX_INDEX_BUFFERS;
|
||||
g_caps.limits.maxVertexBuffers = BGFX_CONFIG_MAX_VERTEX_BUFFERS;
|
||||
g_caps.limits.maxDynamicIndexBuffers = BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS;
|
||||
g_caps.limits.maxDynamicVertexBuffers = BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS;
|
||||
g_caps.limits.maxUniforms = BGFX_CONFIG_MAX_UNIFORMS;
|
||||
g_caps.limits.maxOcclusionQueries = BGFX_CONFIG_MAX_OCCUSION_QUERIES;
|
||||
g_caps.limits.maxFBAttachments = 1;
|
||||
|
||||
g_caps.vendorId = _vendorId;
|
||||
g_caps.deviceId = _deviceId;
|
||||
|
||||
@@ -3565,7 +3608,7 @@ error:
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS);
|
||||
BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
|
||||
BX_CHECK(_attachment < g_caps.limits.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
|
||||
s_ctx->setTexture(_stage, _sampler, _handle, _attachment, _flags);
|
||||
}
|
||||
|
||||
@@ -3644,7 +3687,7 @@ error:
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS);
|
||||
BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
|
||||
BX_CHECK(_attachment < g_caps.limits.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
|
||||
s_ctx->setImage(_stage, _sampler, _handle, _attachment, _access, _format);
|
||||
}
|
||||
|
||||
@@ -3687,7 +3730,7 @@ error:
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_BLIT, "Texture blit is not supported!");
|
||||
BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
|
||||
BX_CHECK(_attachment < g_caps.limits.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
|
||||
s_ctx->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _attachment, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
||||
}
|
||||
|
||||
@@ -3757,6 +3800,7 @@ BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffe
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t);
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Attachment, bgfx_attachment_t);
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::GPU, bgfx_caps_gpu_t);
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::Limits, bgfx_caps_limits_t);
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps, bgfx_caps_t);
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::PlatformData, bgfx_platform_data_t);
|
||||
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
|
||||
|
||||
@@ -3303,7 +3303,7 @@ namespace bgfx
|
||||
}
|
||||
}
|
||||
|
||||
return color <= g_caps.maxFBAttachments
|
||||
return color <= g_caps.limits.maxFBAttachments
|
||||
&& depth <= 1
|
||||
;
|
||||
}
|
||||
@@ -3313,7 +3313,7 @@ namespace bgfx
|
||||
BX_CHECK(checkFrameBuffer(_num, _attachment)
|
||||
, "Too many frame buffer attachments (num attachments: %d, max color attachments %d)!"
|
||||
, _num
|
||||
, g_caps.maxFBAttachments
|
||||
, g_caps.limits.maxFBAttachments
|
||||
);
|
||||
|
||||
FrameBufferHandle handle = { m_frameBufferHandle.alloc() };
|
||||
|
||||
@@ -1285,19 +1285,19 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
if (m_featureLevel <= D3D_FEATURE_LEVEL_9_2)
|
||||
{
|
||||
g_caps.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
g_caps.limits.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
}
|
||||
else if (m_featureLevel == D3D_FEATURE_LEVEL_9_3)
|
||||
{
|
||||
g_caps.maxTextureSize = D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
g_caps.limits.maxTextureSize = D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
}
|
||||
else
|
||||
{
|
||||
g_caps.supported |= BGFX_CAPS_TEXTURE_COMPARE_ALL;
|
||||
g_caps.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
g_caps.limits.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
}
|
||||
|
||||
// 32-bit indices only supported on 9_2+.
|
||||
|
||||
@@ -1005,8 +1005,8 @@ namespace bgfx { namespace d3d12
|
||||
| BGFX_CAPS_TEXTURE_2D_ARRAY
|
||||
| BGFX_CAPS_TEXTURE_CUBE_ARRAY
|
||||
);
|
||||
g_caps.maxTextureSize = 16384;
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
g_caps.limits.maxTextureSize = 16384;
|
||||
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
|
||||
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
|
||||
{
|
||||
|
||||
@@ -578,11 +578,10 @@ namespace bgfx { namespace d3d9
|
||||
| BGFX_CAPS_TEXTURE_READ_BACK
|
||||
| (m_occlusionQuerySupport ? BGFX_CAPS_OCCLUSION_QUERY : 0)
|
||||
);
|
||||
g_caps.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) );
|
||||
// g_caps.maxVertexIndex = m_caps.MaxVertexIndex;
|
||||
g_caps.limits.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) );
|
||||
|
||||
m_caps.NumSimultaneousRTs = uint8_t(bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
|
||||
g_caps.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs);
|
||||
g_caps.limits.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs);
|
||||
|
||||
m_caps.MaxAnisotropy = bx::uint32_max(m_caps.MaxAnisotropy, 1);
|
||||
|
||||
@@ -1358,7 +1357,7 @@ namespace bgfx { namespace d3d9
|
||||
if (!isValid(_fbh) )
|
||||
{
|
||||
DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) );
|
||||
for (uint32_t ii = 1, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 1, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
|
||||
}
|
||||
@@ -1391,7 +1390,7 @@ namespace bgfx { namespace d3d9
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t ii = rtIdx, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = rtIdx, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
|
||||
}
|
||||
@@ -1508,7 +1507,7 @@ namespace bgfx { namespace d3d9
|
||||
}
|
||||
|
||||
DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) );
|
||||
for (uint32_t ii = 1, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 1, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
|
||||
}
|
||||
|
||||
@@ -1460,6 +1460,7 @@ namespace bgfx { namespace gl
|
||||
if (0 == strncmp(vendorId.name, m_vendor, strlen(vendorId.name) ) )
|
||||
{
|
||||
g_caps.vendorId = vendorId.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1959,14 +1960,14 @@ namespace bgfx { namespace gl
|
||||
: 0
|
||||
;
|
||||
|
||||
g_caps.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
|
||||
g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|
||||
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|
||||
|| s_extension[Extension::EXT_draw_buffers ].m_supported
|
||||
|| s_extension[Extension::WEBGL_draw_buffers].m_supported)
|
||||
{
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS)
|
||||
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS)
|
||||
, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS)
|
||||
);
|
||||
}
|
||||
@@ -5520,7 +5521,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (!!bx::findIdentifierMatch(code, "gl_FragData") )
|
||||
{
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
char tmpFragData[16];
|
||||
bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii);
|
||||
@@ -5610,7 +5611,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (!!bx::findIdentifierMatch(code, "gl_FragData") )
|
||||
{
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
char tmpFragData[16];
|
||||
bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii);
|
||||
|
||||
@@ -504,19 +504,19 @@ namespace bgfx { namespace mtl
|
||||
{
|
||||
if (iOSVersionEqualOrGreater("9.0.0") )
|
||||
{
|
||||
g_caps.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192;
|
||||
g_caps.limits.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_caps.maxTextureSize = 4096;
|
||||
g_caps.limits.maxTextureSize = 4096;
|
||||
}
|
||||
|
||||
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
|
||||
g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
|
||||
}
|
||||
else if (BX_ENABLED(BX_PLATFORM_OSX) )
|
||||
{
|
||||
g_caps.maxTextureSize = 16384;
|
||||
g_caps.maxFBAttachments = 8;
|
||||
g_caps.limits.maxTextureSize = 16384;
|
||||
g_caps.limits.maxFBAttachments = 8;
|
||||
g_caps.supported |= BGFX_CAPS_TEXTURE_CUBE_ARRAY;
|
||||
}
|
||||
|
||||
@@ -1269,7 +1269,7 @@ namespace bgfx { namespace mtl
|
||||
RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor();
|
||||
setFrameBuffer(renderPassDescriptor, m_renderCommandEncoderFrameBufferHandle);
|
||||
|
||||
for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii)
|
||||
for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii)
|
||||
{
|
||||
MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii];
|
||||
if ( desc.texture != NULL)
|
||||
@@ -3128,7 +3128,7 @@ namespace bgfx { namespace mtl
|
||||
|
||||
if ( clearWithRenderPass )
|
||||
{
|
||||
for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii)
|
||||
for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii)
|
||||
{
|
||||
MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii];
|
||||
|
||||
@@ -3190,7 +3190,7 @@ namespace bgfx { namespace mtl
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii)
|
||||
for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii)
|
||||
{
|
||||
MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii];
|
||||
if ( desc.texture != NULL)
|
||||
|
||||
Reference in New Issue
Block a user