From cc5b698a95ba11691c151399ae53fc5b29c57a9f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 14 Jan 2013 13:02:14 +0100 Subject: [PATCH] Check for GLX_ARB_create_context extension before using it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Samuel Rødal Reviewed-by: Sean Harmer --- src/plugins/platforms/xcb/qglxintegration.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 10aaa5a3b5..6b7cd6630b 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -284,8 +284,10 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0; glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); + QList 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