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>
This commit is contained in:
David Edmundson 2018-12-31 00:38:05 +00:00
parent cf53ed97a1
commit 6abed98e87

View File

@ -62,6 +62,10 @@ QT_BEGIN_NAMESPACE
typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint); typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
#endif #endif
#ifndef GL_CONTEXT_LOST
#define GL_CONTEXT_LOST 0x0507
#endif
QOpenGLExtensionMatcher::QOpenGLExtensionMatcher() QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
{ {
QOpenGLContext *ctx = QOpenGLContext::currentContext(); QOpenGLContext *ctx = QOpenGLContext::currentContext();
@ -82,8 +86,13 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
} else { } else {
#ifdef QT_OPENGL_3 #ifdef QT_OPENGL_3
// clear error state // 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"); qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
if (!glGetStringi) if (!glGetStringi)