From 6abed98e8781a0eebb908e32b9a88cc87492da4d Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 31 Dec 2018 00:38:05 +0000 Subject: 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 --- src/gui/opengl/qopengl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gui/opengl/qopengl.cpp') 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) -- cgit v1.2.3