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>
This commit is contained in:
Laszlo Agocs 2022-10-28 17:13:28 +02:00
parent ad80533473
commit 062efb305e

View File

@ -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;