Merge pull request #1076 from dariomanesku/vb_stream

Fixing OGL multiple vertex streams.
This commit is contained in:
Branimir Karadžić 2017-03-13 00:13:39 -07:00 committed by GitHub
commit 0d2a5521d0

View File

@ -7165,18 +7165,10 @@ namespace bgfx { namespace gl
streamMask >>= ntz;
idx += ntz;
uint16_t handle = draw.m_stream[idx].m_handle.idx;
if (invalidHandle != handle)
{
VertexBufferGL& vb = m_vertexBuffers[handle];
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
bindAttribs = true;
}
else
{
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
}
currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle;
}
bindAttribs = true;
}
if (currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx)
@ -7224,8 +7216,11 @@ namespace bgfx { namespace gl
streamMask >>= ntz;
idx += ntz;
currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex;
const VertexBufferGL& vb = m_vertexBuffers[draw.m_stream[idx].m_handle.idx];
uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx;
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
program.bindAttributes(m_vertexDecls[decl], draw.m_stream[idx].m_startVertex);
}
program.bindAttributesEnd();