diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-10-28 17:13:28 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-31 11:44:51 +0000 |
commit | 4b146bf4f38b2d54b15475d538297e067daca422 (patch) | |
tree | e2c4f5de2d1cf950f51c76b4c26630a9f181f284 | |
parent | 7b7c9c699633eeca992da5409158bc29ac2635e6 (diff) | |
download | qtbase-4b146bf4f38b2d54b15475d538297e067daca422.tar.gz |
rhi: gl: Skip the prim.restart enable on WebGL2
Doing so generates an error as this value for glEnable is
invalid with WebGL 2. The behavior is always as if this
was enabled. (unlike in GLES 3)
Task-number: QTBUG-107780
Change-Id: I3fc34329fc573a6fac8e4265d90ca93520e4e2ee
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 062efb305e1866482c03717ed1cf9717f45e5abb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 6b3207e05d..a12a0b551e 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -725,8 +725,15 @@ bool QRhiGles2::create(QRhi::Flags flags) else caps.fixedIndexPrimitiveRestart = caps.ctxMajor > 4 || (caps.ctxMajor == 4 && caps.ctxMinor >= 3); // 4.3 - if (caps.fixedIndexPrimitiveRestart) + if (caps.fixedIndexPrimitiveRestart) { +#ifdef Q_OS_WASM + // WebGL 2 behaves as if GL_PRIMITIVE_RESTART_FIXED_INDEX was always + // enabled (i.e. matching D3D/Metal), and the value cannot be passed to + // glEnable, so skip the call. +#else f->glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX); +#endif + } caps.bgraExternalFormat = f->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat); caps.bgraInternalFormat = caps.bgraExternalFormat && caps.gles; |