From 69701cb8c4645b4e336abfb609b1756070b8e179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 6 Feb 2013 16:53:12 +0100 Subject: Fix the GL_CONTEXT_PROFILE_MASK check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bit mask can have more than one bit set, so we can't use a switch statement here. Also use the correct enums, and make sure that the profile is set to QSurfaceFormat::NoProfile when the OpenGL version is less than 3.2. Change-Id: I6d2c4e35d4fb3d87fd47c9724cb415f8619a7b95 Reviewed-by: Sean Harmer Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qglxintegration.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/plugins/platforms/xcb/qglxintegration.cpp') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index d4998432d9..015c51572f 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -168,6 +168,8 @@ static void updateFormatFromContext(QSurfaceFormat &format) format.setMinorVersion(minor); } + format.setProfile(QSurfaceFormat::NoProfile); + const int version = (major << 8) + minor; if (version < 0x0300) { format.setProfile(QSurfaceFormat::NoProfile); @@ -189,17 +191,11 @@ static void updateFormatFromContext(QSurfaceFormat &format) // Version 3.2 and newer have a profile value = 0; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); - switch (value) { - case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: + + if (value & GL_CONTEXT_CORE_PROFILE_BIT) format.setProfile(QSurfaceFormat::CoreProfile); - break; - case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) format.setProfile(QSurfaceFormat::CompatibilityProfile); - break; - default: - format.setProfile(QSurfaceFormat::NoProfile); - break; - } } /*! -- cgit v1.2.3