Check for GLX_ARB_create_context extension before using it.

Mesa has started defining glXCreateContextAttribsARB even when it is not
supported as a feature. To be sure it is safe to use, we need to also check
if it is supported extension.

Change-Id: Ie160dc2b2418a726957b59f47bd290b742562ae3
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Allan Sandfeld Jensen 2013-01-14 13:02:14 +01:00 committed by The Qt Project
parent ac864956f8
commit cc5b698a95

View File

@ -284,8 +284,10 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' ');
// Use glXCreateContextAttribsARB if is available
if (glXCreateContextAttribsARB != 0) {
if (glxExt.contains("GLX_ARB_create_context") && glXCreateContextAttribsARB != 0) {
// We limit the requested version by the version of the static context as
// glXCreateContextAttribsARB fails and returns NULL if the requested context
// version is not supported. This means that we will get the closest supported