summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2023-04-12 13:16:00 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-12 17:01:32 +0000
commit448489ce360bf260b2dc43f48aa5aa68a974cdb1 (patch)
treeb459aa6783ec187c5fe67c44286d47a025a4e11c /src
parenta458c7b36284131ebe8a4ba7502404b34f7bf929 (diff)
downloadqtbase-448489ce360bf260b2dc43f48aa5aa68a974cdb1.tar.gz
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 Fixes: QTBUG-105921 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit be375614971d89365138fa4b899239da729940cb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/opengl/platform/egl/qeglconvenience.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/opengl/platform/egl/qeglconvenience.cpp b/src/gui/opengl/platform/egl/qeglconvenience.cpp
index 3d5b99c38c..5124e2e5dc 100644
--- a/src/gui/opengl/platform/egl/qeglconvenience.cpp
+++ b/src/gui/opengl/platform/egl/qeglconvenience.cpp
@@ -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);