Fix crash when hitting max draw call limit (#2440)

* Expand instancing demo to have non-instanced path

* Fix count vs. index off by one error when hitting max draw calls
This commit is contained in:
Vladimir Vukicevic
2021-04-01 19:03:01 -07:00
committed by GitHub
parent e38920c07b
commit cb77d3bb46
2 changed files with 135 additions and 64 deletions

View File

@@ -1237,7 +1237,7 @@ namespace bgfx
}
const uint32_t renderItemIdx = bx::atomicFetchAndAddsat<uint32_t>(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS);
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx)
if (BGFX_CONFIG_MAX_DRAW_CALLS <= renderItemIdx)
{
discard(_flags);
++m_numDropped;