diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-10-28 17:13:28 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-10-31 13:44:41 +0200 |
commit | 062efb305e1866482c03717ed1cf9717f45e5abb (patch) | |
tree | 0adafda42011752d78e9bc1c2505430e9e65a1de /src/gui/rhi/qrhigles2.cpp | |
parent | ad805334736bc18e46c6a8bb73be6913efd7e3f2 (diff) | |
download | qtbase-062efb305e1866482c03717ed1cf9717f45e5abb.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
Pick-to: 6.4
Change-Id: I3fc34329fc573a6fac8e4265d90ca93520e4e2ee
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-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 4cb37a4cd6..1a7be9eb49 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -741,8 +741,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; |