summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2018-12-31 00:38:05 +0000
committerDavid Edmundson <davidedmundson@kde.org>2019-01-29 11:15:24 +0000
commit6abed98e8781a0eebb908e32b9a88cc87492da4d (patch)
tree0f4a2393900c6bca7f26a6345a51905a01c78903
parentcf53ed97a113751f3130543e3a1e853d45817dd9 (diff)
Fixups for GL_CONTEXT_LOST in QOpenGLExtensionMatcher
Fixes the rest of the places we use the pattern of emptying the OpenGL error stack to be able to handle GL_CONTEXT_LOST. Change-Id: Ic45024fc6df84d70d60c48831fa586f889af0c0b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/gui/opengl/qopengl.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index 3a476978e7..987cbe7c12 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -62,6 +62,10 @@ QT_BEGIN_NAMESPACE
typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
#endif
+#ifndef GL_CONTEXT_LOST
+#define GL_CONTEXT_LOST 0x0507
+#endif
+
QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
@@ -82,8 +86,13 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
} else {
#ifdef QT_OPENGL_3
// clear error state
- while (funcs->glGetError()) {}
-
+ while (true) { // Clear error state.
+ GLenum error = funcs->glGetError();
+ if (error == GL_NO_ERROR)
+ break;
+ if (error == GL_CONTEXT_LOST)
+ return;
+ };
qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
if (!glGetStringi)