summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFredrik Höglund <fredrik@kde.org>2013-02-06 16:53:12 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-13 21:35:24 +0100
commit69701cb8c4645b4e336abfb609b1756070b8e179 (patch)
treecc49e31cae9a83c553a12af6ca87008b447a08c4 /src/plugins
parent2ed081a88bce69a40dacf4c32fa0b3565da97f16 (diff)
Fix the GL_CONTEXT_PROFILE_MASK check
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 <sean.harmer@kdab.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp13
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp14
2 files changed, 8 insertions, 19 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 544f5e2c8c..3cf2113f63 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -696,8 +696,8 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current()
result.version = (version.mid(0, majorDot).toInt() << 8)
+ version.mid(majorDot + 1, minorDot - majorDot - 1).toInt();
}
+ result.profile = QSurfaceFormat::NoProfile;
if (result.version < 0x0300) {
- result.profile = QSurfaceFormat::NoProfile;
result.options |= QSurfaceFormat::DeprecatedFunctions;
return result;
}
@@ -713,17 +713,10 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current()
// v3.2 onwards: Profiles
value = 0;
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
- switch (value) {
- case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:
+ if (value & GL_CONTEXT_CORE_PROFILE_BIT)
result.profile = QSurfaceFormat::CoreProfile;
- break;
- case WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
+ else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
result.profile = QSurfaceFormat::CompatibilityProfile;
- break;
- default:
- result.profile = QSurfaceFormat::NoProfile;
- break;
- }
return result;
}
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;
- }
}
/*!