Skip to content

Commit

Permalink
RHI: Fix attribute instancing cleanup for OpenGL ES
Browse files Browse the repository at this point in the history
The previous attribute instancing patch (6493b93) performed the
cleanup too late for the case where the command buffer ends with an
EndFrame command and core profile is used. Resetting the attribute
divisors needs to be done before the vertex array is unbound.
Otherwise the state will be wrong at the start of the next call
to executeCommandBuffer(), which is normally the start of the next
frame.

Change-Id: Ic76695b4d334ed1c1e816e747417d957c387a88b
Reviewed-by: Laszlo Agocs <[email protected]>
  • Loading branch information
paulolav committed Nov 27, 2020
1 parent 420e27c commit 16fa6e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/rhi/qrhigles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,15 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
}
break;
case QGles2CommandBuffer::Command::EndFrame:
if (instancedAttributesUsed) {
for (int i = 0; i < TRACKED_ATTRIB_COUNT; ++i) {
if (nonzeroAttribDivisor[i])
f->glVertexAttribDivisor(GLuint(i), 0);
}
for (int i = TRACKED_ATTRIB_COUNT; i <= maxUntrackedInstancedAttribute; ++i)
f->glVertexAttribDivisor(GLuint(i), 0);
instancedAttributesUsed = false;
}
if (vao)
f->glBindVertexArray(0);
break;
Expand Down

0 comments on commit 16fa6e2

Please sign in to comment.