diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-03-13 17:17:47 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-03-13 17:17:47 +0000 |
commit | 0e1d41b29b32dcdffe2bb58cc83c24088219e6e1 (patch) | |
tree | 6421b43bba0df2ac79947f734450b08221f3fae4 /helpers/glprofile.cpp | |
parent | 8a460c5003ff2626de410572bc9a82bbc8a56a66 (diff) |
glretrace: Cleanup Profile::matches.
Diffstat (limited to 'helpers/glprofile.cpp')
-rw-r--r-- | helpers/glprofile.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/helpers/glprofile.cpp b/helpers/glprofile.cpp index de996b33..8004add4 100644 --- a/helpers/glprofile.cpp +++ b/helpers/glprofile.cpp @@ -35,6 +35,48 @@ namespace glprofile { +bool +Profile::matches(const Profile expected) const +{ + if (api != expected.api) { + return false; + } + + if (!versionGreaterOrEqual(expected.major, expected.minor)) { + return false; + } + + /* + * GLX_ARB_create_context/WGL_ARB_create_context specs state that + * + * "If version 3.1 is requested, the context returned may implement + * any of the following versions: + * + * * Version 3.1. The GL_ARB_compatibility extension may or may not + * be implemented, as determined by the implementation. + * + * * The core profile of version 3.2 or greater." + */ + if (core != expected.core && + (expected.major != 3 || expected.minor != 1)) { + return false; + } + + /* + * Only check forward-compatible flag prior to 3.2 contexts. + * + * Note that on MacOSX all 3.2+ context must be forward-compatible. + */ +#ifndef __APPLE__ + if (forwardCompatible > expected.forwardCompatible) { + return false; + } +#endif + + return true; +} + + std::ostream & operator << (std::ostream &os, const Profile & profile) { os << "OpenGL"; |