diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-03-11 15:37:22 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-03-14 15:13:06 +0000 |
commit | 4676418842faed412b190d691c6a5167543fd779 (patch) | |
tree | 9f6ad4ea3c31a90d424e4b5133c0584399bc3927 /src/gui/rhi/qrhigles2.cpp | |
parent | 67385c04ce272cf553bc2e8aa8e923cd7851fc66 (diff) |
wasm: prevent WebGL vertex attribute errors
WebGL is stricter than OpenGL ES and require that unused
vertex attribute arrays are disabled. This prevents
errors such as:
WebGL: INVALID_OPERATION: drawElements: no buffer
is bound to enabled attribute
Pick-to: 6.3
Change-Id: I68384a9f6954b6a1960ba6e8afd1fdbdfefe2335
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index e7a2382497..adb6614336 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -2753,6 +2753,14 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb) f->glVertexAttribDivisor(GLuint(i), 0); state.instancedAttributesUsed = false; } +#ifdef Q_OS_WASM + for (int i = 0; i < CommandBufferExecTrackedState::TRACKED_ATTRIB_COUNT; ++i) { + if (state.enabledAttribArrays[i]) { + f->glDisableVertexAttribArray(GLuint(i)); + state.enabledAttribArrays[i] = false; + } + } +#endif if (vao) f->glBindVertexArray(0); break; |