Fixed issue #447.
This commit is contained in:
parent
b166bc8f1b
commit
6c48b12a3f
@ -5707,6 +5707,7 @@ namespace bgfx { namespace gl
|
|||||||
{
|
{
|
||||||
const IndexBufferGL& ib = m_indexBuffers[draw.m_indexBuffer.idx];
|
const IndexBufferGL& ib = m_indexBuffers[draw.m_indexBuffer.idx];
|
||||||
const bool hasIndex16 = 0 == (ib.m_flags & BGFX_BUFFER_INDEX32);
|
const bool hasIndex16 = 0 == (ib.m_flags & BGFX_BUFFER_INDEX32);
|
||||||
|
const uint32_t indexSize = hasIndex16 ? 2 : 4;
|
||||||
const GLenum indexFormat = hasIndex16
|
const GLenum indexFormat = hasIndex16
|
||||||
? GL_UNSIGNED_SHORT
|
? GL_UNSIGNED_SHORT
|
||||||
: GL_UNSIGNED_INT
|
: GL_UNSIGNED_INT
|
||||||
@ -5714,7 +5715,6 @@ namespace bgfx { namespace gl
|
|||||||
|
|
||||||
if (UINT32_MAX == draw.m_numIndices)
|
if (UINT32_MAX == draw.m_numIndices)
|
||||||
{
|
{
|
||||||
const uint32_t indexSize = hasIndex16 ? 2 : 4;
|
|
||||||
numIndices = ib.m_size/indexSize;
|
numIndices = ib.m_size/indexSize;
|
||||||
numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
|
numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
|
||||||
numInstances = draw.m_numInstances;
|
numInstances = draw.m_numInstances;
|
||||||
@ -5737,7 +5737,7 @@ namespace bgfx { namespace gl
|
|||||||
GL_CHECK(glDrawElementsInstanced(prim.m_type
|
GL_CHECK(glDrawElementsInstanced(prim.m_type
|
||||||
, numIndices
|
, numIndices
|
||||||
, indexFormat
|
, indexFormat
|
||||||
, (void*)(uintptr_t)(draw.m_startIndex*2)
|
, (void*)(uintptr_t)(draw.m_startIndex*indexSize)
|
||||||
, draw.m_numInstances
|
, draw.m_numInstances
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user