diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 8ad04aa99..1915328dc 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -1129,7 +1129,7 @@ bool Context::isCoreProfileInternal(Implementation::ContextState& state) { that */ if(_version < Version::GL320) value = Implementation::ContextState::CoreProfile::Compatibility; - else value = (this->*state.isCoreProfileImplementation)() ? + else value = state.isCoreProfileImplementation(*this) ? Implementation::ContextState::CoreProfile::Core : Implementation::ContextState::CoreProfile::Compatibility; } @@ -1137,14 +1137,14 @@ bool Context::isCoreProfileInternal(Implementation::ContextState& state) { return value == Implementation::ContextState::CoreProfile::Core; } -bool Context::isCoreProfileImplementationDefault() { +bool Context::isCoreProfileImplementationDefault(Context&) { GLint value = 0; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); return value & GL_CONTEXT_CORE_PROFILE_BIT; } -bool Context::isCoreProfileImplementationNV() { - auto extensions = extensionStrings(); +bool Context::isCoreProfileImplementationNV(Context& self) { + auto extensions = self.extensionStrings(); return std::find(extensions.begin(), extensions.end(), "GL_ARB_compatibility") == extensions.end(); } #endif diff --git a/src/Magnum/GL/Context.h b/src/Magnum/GL/Context.h index 071f3af83..45065ffe8 100644 --- a/src/Magnum/GL/Context.h +++ b/src/Magnum/GL/Context.h @@ -881,8 +881,8 @@ class MAGNUM_GL_EXPORT Context { MAGNUM_GL_LOCAL void setupDriverWorkarounds(); #ifndef MAGNUM_TARGET_GLES - MAGNUM_GL_LOCAL bool isCoreProfileImplementationDefault(); - MAGNUM_GL_LOCAL bool isCoreProfileImplementationNV(); + MAGNUM_GL_LOCAL static bool isCoreProfileImplementationDefault(Context& self); + MAGNUM_GL_LOCAL static bool isCoreProfileImplementationNV(Context& self); #endif void(*_functionLoader)(Context&){}; diff --git a/src/Magnum/GL/Implementation/ContextState.h b/src/Magnum/GL/Implementation/ContextState.h index f159a3231..869b82c01 100644 --- a/src/Magnum/GL/Implementation/ContextState.h +++ b/src/Magnum/GL/Implementation/ContextState.h @@ -28,13 +28,6 @@ #include "Magnum/Magnum.h" #include "Magnum/GL/GL.h" -#ifdef _MSC_VER -/* Otherwise the member function pointers will have different size based on - whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND - IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */ -#include "Magnum/GL/Context.h" -#endif - namespace Magnum { namespace GL { namespace Implementation { struct ContextState { @@ -47,7 +40,7 @@ struct ContextState { Compatibility } coreProfile = CoreProfile::Initial; - bool (Context::*isCoreProfileImplementation)(); + bool(*isCoreProfileImplementation)(Context&); #endif };