summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-03-13 16:07:33 +0000
committerJose Fonseca <jfonseca@vmware.com>2015-03-13 16:07:33 +0000
commit56c419c55aef7105bf4991a2b9265c21614d443a (patch)
tree084522d02ff1c0e2e9b20061b1b75aa66dbd37ed /helpers
parentcc41a48baff8d13bcd10cd96879ffdcf29beb1f2 (diff)
glretrace: Set FORWARD_COMPATIBLE_BIT as per trace.
Not thoroughly tested across all platforms. But hopefully close enough.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/glprofile.cpp31
-rw-r--r--helpers/glprofile.hpp19
2 files changed, 37 insertions, 13 deletions
diff --git a/helpers/glprofile.cpp b/helpers/glprofile.cpp
index 6207094e..de996b33 100644
--- a/helpers/glprofile.cpp
+++ b/helpers/glprofile.cpp
@@ -42,9 +42,13 @@ operator << (std::ostream &os, const Profile & profile) {
os << " ES";
}
os << " " << profile.major << "." << profile.minor;
- if (profile.api == API_GL &&
- profile.versionGreaterOrEqual(3, 2)) {
- os << " " << (profile.core ? "core" : "compat");
+ if (profile.api == API_GL) {
+ if (profile.versionGreaterOrEqual(3, 2)) {
+ os << " " << (profile.core ? "core" : "compat");
+ }
+ if (profile.forwardCompatible) {
+ os << " forward-compatible";
+ }
}
return os;
}
@@ -194,12 +198,21 @@ getCurrentContextProfile(void)
}
}
- if (profile.api == API_GL &&
- profile.versionGreaterOrEqual(3, 2)) {
- GLint profileMask = 0;
- _glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profileMask);
- if (profileMask & GL_CONTEXT_CORE_PROFILE_BIT) {
- profile.core = true;
+ if (profile.api == API_GL) {
+ if (profile.versionGreaterOrEqual(3, 0)) {
+ GLint contextFlags = 0;
+ _glGetIntegerv(GL_CONTEXT_FLAGS, &contextFlags);
+ if (contextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) {
+ profile.forwardCompatible = true;
+ }
+ }
+
+ if (profile.versionGreaterOrEqual(3, 2)) {
+ GLint profileMask = 0;
+ _glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profileMask);
+ if (profileMask & GL_CONTEXT_CORE_PROFILE_BIT) {
+ profile.core = true;
+ }
}
}
diff --git a/helpers/glprofile.hpp b/helpers/glprofile.hpp
index cf2947bd..f6ecf578 100644
--- a/helpers/glprofile.hpp
+++ b/helpers/glprofile.hpp
@@ -52,13 +52,21 @@ struct Profile {
unsigned minor:8;
unsigned api:1;
unsigned core:1;
+ unsigned forwardCompatible:1;
inline
- Profile(Api _api = API_GL, unsigned _major = 1, unsigned _minor = 0, bool _core = false) {
+ Profile(
+ Api _api = API_GL,
+ unsigned _major = 1,
+ unsigned _minor = 0,
+ bool _core = false,
+ bool _forwardCompatible = false
+ ) {
api = _api;
major = _major;
minor = _minor;
core = _core;
+ forwardCompatible = _forwardCompatible;
}
inline bool
@@ -93,7 +101,8 @@ struct Profile {
return api == expected.api &&
versionGreaterOrEqual(expected.major, expected.minor) &&
(core == expected.core ||
- (expected.major == 3 && expected.minor == 1));
+ (expected.major == 3 && expected.minor == 1)) &&
+ forwardCompatible <= expected.forwardCompatible;
}
// Comparison operator, mainly for use in std::map
@@ -102,7 +111,8 @@ struct Profile {
return major == other.major &&
minor == other.minor &&
api == other.api &&
- core == other.core;
+ core == other.core &&
+ forwardCompatible == other.forwardCompatible;
}
// Comparison operator, mainly for use in std::map
@@ -111,7 +121,8 @@ struct Profile {
return major < other.major ||
minor < other.minor ||
api < other.api ||
- core < other.core;
+ core < other.core ||
+ forwardCompatible < other.forwardCompatible;
}
};