mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-18 04:53:06 +01:00
Add Unbind Attributes (#1515)
This commit is contained in:
committed by
Бранимир Караџић
parent
29585d85ca
commit
71a1d659dc
@@ -4515,6 +4515,19 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
}
|
||||
}
|
||||
|
||||
void ProgramGL::unbindAttributes()
|
||||
{
|
||||
for(uint32_t ii = 0, iiEnd = m_usedCount; ii < iiEnd; ++ii)
|
||||
{
|
||||
if(Attrib::Count == m_unboundUsedAttrib[ii])
|
||||
{
|
||||
Attrib::Enum attr = Attrib::Enum(m_used[ii]);
|
||||
GLint loc = m_attributes[attr];
|
||||
GL_CHECK(glDisableVertexAttribArray(loc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProgramGL::bindInstanceData(uint32_t _stride, uint32_t _baseVertex) const
|
||||
{
|
||||
uint32_t baseVertex = _baseVertex;
|
||||
@@ -6310,6 +6323,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
viewState.reset(_render, hmdEnabled);
|
||||
|
||||
uint16_t programIdx = kInvalidHandle;
|
||||
uint16_t boundProgramIdx = kInvalidHandle;
|
||||
SortKey key;
|
||||
uint16_t view = UINT16_MAX;
|
||||
FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS };
|
||||
@@ -7145,6 +7159,14 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
|
||||
if (bindAttribs || diffStartVertex)
|
||||
{
|
||||
if(kInvalidHandle != boundProgramIdx)
|
||||
{
|
||||
ProgramGL& boundProgram = m_program[boundProgramIdx];
|
||||
boundProgram.unbindAttributes();
|
||||
}
|
||||
|
||||
boundProgramIdx = programIdx;
|
||||
|
||||
program.bindAttributesBegin();
|
||||
|
||||
if (UINT8_MAX != draw.m_streamMask)
|
||||
@@ -7333,6 +7355,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
}
|
||||
}
|
||||
|
||||
if(kInvalidHandle != boundProgramIdx)
|
||||
{
|
||||
ProgramGL& boundProgram = m_program[boundProgramIdx];
|
||||
boundProgram.unbindAttributes();
|
||||
}
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
|
||||
blitMsaaFbo();
|
||||
|
||||
Reference in New Issue
Block a user