Default NVidia EGL to GLES2

Found some documentation saying NVidia provided desktop GL for
development purposes only, and recommmended against using it. Not sure
if that applied to all NVidia drivers, or only that one embedded
platform, but since we have multiple bugs about EGL not working on
NVidia, default to using GLES2 like it suggested.

Change-Id: If8ac8dd61c4ceb88162360f1eaa2a096acefa9c6
Pick-to: 6.5 6.2
Fixes: QTBUG-105921
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
bb10
Allan Sandfeld Jensen 2023-04-12 13:16:00 +02:00
parent bbd6cbd71c
commit be37561497
1 changed files with 6 additions and 2 deletions

View File

@ -216,14 +216,17 @@ EGLConfig QEglConfigChooser::chooseConfig()
configureAttributes.append(EGL_OPENVG_BIT);
break;
#ifdef EGL_VERSION_1_4
case QSurfaceFormat::DefaultRenderableType:
case QSurfaceFormat::DefaultRenderableType: {
#ifndef QT_NO_OPENGL
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL)
// NVIDIA EGL only provides desktop GL for development purposes, and recommends against using it.
const char *vendor = eglQueryString(display(), EGL_VENDOR);
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL && (!vendor || !strstr(vendor, "NVIDIA")))
configureAttributes.append(EGL_OPENGL_BIT);
else
#endif // QT_NO_OPENGL
needsES2Plus = true;
break;
}
case QSurfaceFormat::OpenGL:
configureAttributes.append(EGL_OPENGL_BIT);
break;
@ -353,6 +356,7 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config,
else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType
#ifndef QT_NO_OPENGL
&& QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
&& !strstr(eglQueryString(display, EGL_VENDOR), "NVIDIA")
#endif
&& (renderableType & EGL_OPENGL_BIT))
format.setRenderableType(QSurfaceFormat::OpenGL);