Avoid calling glGetString on OpenGL 3.0+
To prevent profiling and debugging tools from generating misleading "errors", call glGetString only for ES and GL < 3.0. Task-number: QTBUG-35173 Change-Id: I4fe3b048fff4cda948152e2ceeb1347f2b0e4ca5 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
2978b7ed19
commit
0a03707821
@ -55,16 +55,17 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
|
||||
{
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
QOpenGLFunctions *funcs = ctx->functions();
|
||||
const char *extensionStr = reinterpret_cast<const char *>(funcs->glGetString(GL_EXTENSIONS));
|
||||
const char *extensionStr = 0;
|
||||
|
||||
if (ctx->isOpenGLES() || ctx->format().majorVersion() < 3)
|
||||
extensionStr = reinterpret_cast<const char *>(funcs->glGetString(GL_EXTENSIONS));
|
||||
|
||||
if (extensionStr) {
|
||||
QByteArray ba(extensionStr);
|
||||
QList<QByteArray> extensions = ba.split(' ');
|
||||
m_extensions = extensions.toSet();
|
||||
#if !defined(QT_OPENGL_3)
|
||||
}
|
||||
#else
|
||||
} else {
|
||||
#ifdef QT_OPENGL_3
|
||||
// clear error state
|
||||
while (funcs->glGetError()) {}
|
||||
|
||||
@ -82,8 +83,8 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
|
||||
m_extensions.insert(str);
|
||||
}
|
||||
}
|
||||
#endif // QT_OPENGL_3
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user