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>
This commit is contained in:
parent
67385c04ce
commit
4676418842
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user