diff options
author | José Fonseca <jfonseca@vmware.com> | 2015-01-05 15:16:11 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2015-01-05 15:16:11 +0000 |
commit | a04c50d5e2f1eb6b616ff2f4bd2783c1c38e3fee (patch) | |
tree | 76bd52747ec9b17ab7d32c6976e0ca66521cb170 /retrace/glws.hpp | |
parent | 65da892574cd565fd963e941fbc5a473e0ebb608 (diff) |
glretrace: Promote Profile from enum to full-fledged object.
Diffstat (limited to 'retrace/glws.hpp')
-rw-r--r-- | retrace/glws.hpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/retrace/glws.hpp b/retrace/glws.hpp index 76c9165b..d7d70757 100644 --- a/retrace/glws.hpp +++ b/retrace/glws.hpp @@ -42,45 +42,44 @@ namespace glws { -enum Profile { - PROFILE_INVALID = 0x000, - PROFILE_COMPAT = 0x010, - PROFILE_3_0 = 0x030, - PROFILE_3_1 = 0x031, - PROFILE_3_2_CORE = 0x132, - PROFILE_3_3_CORE = 0x133, - PROFILE_4_0_CORE = 0x140, - PROFILE_4_1_CORE = 0x141, - PROFILE_4_2_CORE = 0x142, - PROFILE_4_3_CORE = 0x143, - PROFILE_4_4_CORE = 0x144, - PROFILE_ES1 = 0x211, - PROFILE_ES2 = 0x220, -}; - - enum Api { API_GL = 0, API_GLES }; -struct ProfileDesc { +struct Profile { Api api; unsigned major; unsigned minor; bool core; + inline + Profile(Api _api = API_GL, unsigned _major = 1, unsigned _minor = 0, bool _core = false) { + api = _api; + major = _major; + minor = _minor; + core = _core; + } + inline bool versionGreaterOrEqual(unsigned refMajor, unsigned refMinor) const { return major > refMajor || (major == refMajor && minor >= refMinor); } -}; + // Comparison operator, mainly for use in std::map + inline bool + operator < (const Profile & other) const { + return api < other.api || + major < other.major || + minor < other.minor || + (int)core < (int)other.core; + } +}; inline std::ostream & -operator << (std::ostream &os, const ProfileDesc & desc) { +operator << (std::ostream &os, const Profile & desc) { os << "OpenGL"; if (desc.api == API_GLES) { os << " ES"; @@ -93,9 +92,13 @@ operator << (std::ostream &os, const ProfileDesc & desc) { return os; } +// Deprecated +typedef Profile ProfileDesc; -void -getProfileDesc(Profile profile, ProfileDesc &desc); +inline void +getProfileDesc(Profile profile, ProfileDesc &desc) { + desc = profile; +} bool @@ -218,7 +221,7 @@ void cleanup(void); Visual * -createVisual(bool doubleBuffer = false, unsigned samples = 1, Profile profile = PROFILE_COMPAT); +createVisual(bool doubleBuffer, unsigned samples, Profile profile); Drawable * createDrawable(const Visual *visual, int width, int height, bool pbuffer = false); |