summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2020-11-26 13:03:56 +0100
committerPaul Olav Tvete <paul.tvete@qt.io>2020-11-27 13:26:51 +0100
commit16fa6e2f62c8850e319624332ecceef835c5847b (patch)
tree48f4e8c53049b5072b502c5817772bb3cacd7937 /src
parent420e27c9efc1ef1a6400dc287345e897036abc71 (diff)
RHI: Fix attribute instancing cleanup for OpenGL ES
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 <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/rhi/qrhigles2.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index 5db9ffb444..cdeb487f1f 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -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;