diff --git a/src/Magnum/GL/DebugOutput.cpp b/src/Magnum/GL/DebugOutput.cpp index eddfde54e..6eb5e555b 100644 --- a/src/Magnum/GL/DebugOutput.cpp +++ b/src/Magnum/GL/DebugOutput.cpp @@ -178,22 +178,10 @@ void DebugOutput::setDefaultCallback() { } void DebugOutput::setEnabledInternal(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list ids, const bool enabled) { - Context::current().state().debug.controlImplementation(source, type, severity, ids, enabled); + Context::current().state().debug.controlImplementation(source, type, severity, ids.size(), ids.begin(), enabled); } -void DebugOutput::controlImplementationNoOp(GLenum, GLenum, GLenum, std::initializer_list, bool) {} - -#ifndef MAGNUM_TARGET_GLES2 -void DebugOutput::controlImplementationKhrDesktopES32(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list ids, const bool enabled) { - glDebugMessageControl(source, type, severity, ids.size(), ids.begin(), enabled); -} -#endif - -#ifdef MAGNUM_TARGET_GLES -void DebugOutput::controlImplementationKhrES(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list ids, const bool enabled) { - glDebugMessageControlKHR(source, type, severity, ids.size(), ids.begin(), enabled); -} -#endif +void DebugOutput::controlImplementationNoOp(GLenum, GLenum, GLenum, GLsizei, const GLuint*, GLboolean) {} void DebugOutput::callbackImplementationNoOp(Callback) {} @@ -290,30 +278,18 @@ Debug& operator<<(Debug& debug, const DebugOutput::Severity value) { #endif void DebugMessage::insert(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::StringView string) { - Context::current().state().debug.messageInsertImplementation(source, type, id, severity, string); + Context::current().state().debug.messageInsertImplementation(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data()); } -void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::StringView) {} +void DebugMessage::insertImplementationNoOp(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*) {} -#ifndef MAGNUM_TARGET_GLES2 -void DebugMessage::insertImplementationKhrDesktopES32(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::StringView string) { - glDebugMessageInsert(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data()); -} -#endif - -#ifdef MAGNUM_TARGET_GLES -void DebugMessage::insertImplementationKhrES(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::StringView string) { - glDebugMessageInsertKHR(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data()); -} -#endif - -void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::StringView string) { - glInsertEventMarkerEXT(string.size(), string.data()); +void DebugMessage::insertImplementationExt(GLenum, GLenum, GLuint, GLenum, const GLsizei length, const GLchar* const message) { + glInsertEventMarkerEXT(length, message); } #ifndef MAGNUM_TARGET_GLES -void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::StringView string) { - glStringMarkerGREMEDY(string.size(), string.data()); +void DebugMessage::insertImplementationGremedy(GLenum, GLenum, GLuint, GLenum, const GLsizei length, const GLchar* const message) { + glStringMarkerGREMEDY(length, message); } #endif @@ -375,7 +351,7 @@ DebugGroup::DebugGroup(const Source source, const UnsignedInt id, const Containe void DebugGroup::push(const Source source, const UnsignedInt id, const Containers::StringView message) { CORRADE_ASSERT(!_active, "GL::DebugGroup::push(): group is already active", ); - Context::current().state().debug.pushGroupImplementation(source, id, message); + Context::current().state().debug.pushGroupImplementation(GLenum(source), id, message.size(), message.data()); _active = true; } @@ -385,42 +361,14 @@ void DebugGroup::pop() { _active = false; } -void DebugGroup::pushImplementationNoOp(Source, UnsignedInt, Containers::StringView) {} - -#ifndef MAGNUM_TARGET_GLES2 -void DebugGroup::pushImplementationKhrDesktopES32(const Source source, const UnsignedInt id, const Containers::StringView message) { - glPushDebugGroup(GLenum(source), id, message.size(), message.data()); -} -#endif - -#ifdef MAGNUM_TARGET_GLES -void DebugGroup::pushImplementationKhrES(const Source source, const UnsignedInt id, const Containers::StringView message) { - glPushDebugGroupKHR(GLenum(source), id, message.size(), message.data()); -} -#endif +void DebugGroup::pushImplementationNoOp(GLenum, GLuint, GLsizei, const GLchar*) {} -void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::StringView message) { - glPushGroupMarkerEXT(message.size(), message.data()); +void DebugGroup::pushImplementationExt(GLenum, GLuint, const GLsizei length, const GLchar* const message) { + glPushGroupMarkerEXT(length, message); } void DebugGroup::popImplementationNoOp() {} -#ifndef MAGNUM_TARGET_GLES2 -void DebugGroup::popImplementationKhrDesktopES32() { - glPopDebugGroup(); -} -#endif - -#ifdef MAGNUM_TARGET_GLES -void DebugGroup::popImplementationKhrES() { - glPopDebugGroupKHR(); -} -#endif - -void DebugGroup::popImplementationExt() { - glPopGroupMarkerEXT(); -} - #ifndef DOXYGEN_GENERATING_OUTPUT Debug& operator<<(Debug& debug, const DebugGroup::Source value) { debug << "GL::DebugGroup::Source" << Debug::nospace; diff --git a/src/Magnum/GL/DebugOutput.h b/src/Magnum/GL/DebugOutput.h index c215141d8..aa58b30c5 100644 --- a/src/Magnum/GL/DebugOutput.h +++ b/src/Magnum/GL/DebugOutput.h @@ -437,13 +437,9 @@ class MAGNUM_GL_EXPORT DebugOutput { private: static void setEnabledInternal(GLenum source, GLenum type, GLenum severity, std::initializer_list ids, bool enabled); - static MAGNUM_GL_LOCAL void controlImplementationNoOp(GLenum, GLenum, GLenum, std::initializer_list, bool); - #ifndef MAGNUM_TARGET_GLES2 - static MAGNUM_GL_LOCAL void controlImplementationKhrDesktopES32(GLenum source, GLenum type, GLenum severity, std::initializer_list ids, bool enabled); - #endif - #ifdef MAGNUM_TARGET_GLES - static MAGNUM_GL_LOCAL void controlImplementationKhrES(GLenum source, GLenum type, GLenum severity, std::initializer_list ids, bool enabled); - #endif + /* This one is combined with direct pointers to the GL functions, so + needs a __stdcall on Windows to compile properly on 32 bits */ + static MAGNUM_GL_LOCAL void APIENTRY controlImplementationNoOp(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); static MAGNUM_GL_LOCAL void callbackImplementationNoOp(Callback callback); #ifndef MAGNUM_TARGET_GLES2 @@ -616,16 +612,12 @@ class MAGNUM_GL_EXPORT DebugMessage { DebugMessage() = delete; private: - static MAGNUM_GL_LOCAL void insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::StringView); - #ifndef MAGNUM_TARGET_GLES2 - static MAGNUM_GL_LOCAL void insertImplementationKhrDesktopES32(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::StringView string); - #endif - #ifdef MAGNUM_TARGET_GLES - static MAGNUM_GL_LOCAL void insertImplementationKhrES(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::StringView string); - #endif - static MAGNUM_GL_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::StringView string); + /* These are combined with direct pointers to the GL functions, so need + a __stdcall on Windows to compile properly on 32 bits */ + static MAGNUM_GL_LOCAL void APIENTRY insertImplementationNoOp(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message); + static MAGNUM_GL_LOCAL void APIENTRY insertImplementationExt(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message); #ifndef MAGNUM_TARGET_GLES - static MAGNUM_GL_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::StringView string); + static MAGNUM_GL_LOCAL void APIENTRY insertImplementationGremedy(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message); #endif }; @@ -799,23 +791,11 @@ class MAGNUM_GL_EXPORT DebugGroup { void pop(); private: - static MAGNUM_GL_LOCAL void pushImplementationNoOp(Source source, UnsignedInt id, Containers::StringView message); - #ifndef MAGNUM_TARGET_GLES2 - static MAGNUM_GL_LOCAL void pushImplementationKhrDesktopES32(Source source, UnsignedInt id, Containers::StringView message); - #endif - #ifdef MAGNUM_TARGET_GLES - static MAGNUM_GL_LOCAL void pushImplementationKhrES(Source source, UnsignedInt id, Containers::StringView message); - #endif - static MAGNUM_GL_LOCAL void pushImplementationExt(Source source, UnsignedInt id, Containers::StringView message); - - static MAGNUM_GL_LOCAL void popImplementationNoOp(); - #ifndef MAGNUM_TARGET_GLES2 - static MAGNUM_GL_LOCAL void popImplementationKhrDesktopES32(); - #endif - #ifdef MAGNUM_TARGET_GLES - static MAGNUM_GL_LOCAL void popImplementationKhrES(); - #endif - static MAGNUM_GL_LOCAL void popImplementationExt(); + /* These are combined with direct pointers to the GL functions, so need + a __stdcall on Windows to compile properly on 32 bits */ + static MAGNUM_GL_LOCAL void APIENTRY pushImplementationNoOp(GLenum source, GLuint id, GLsizei length, const GLchar* message); + static MAGNUM_GL_LOCAL void APIENTRY pushImplementationExt(GLenum source, GLuint id, GLsizei length, const GLchar* message); + static MAGNUM_GL_LOCAL void APIENTRY popImplementationNoOp(); bool _active; }; diff --git a/src/Magnum/GL/Implementation/DebugState.cpp b/src/Magnum/GL/Implementation/DebugState.cpp index 57e7ac887..75acf122e 100644 --- a/src/Magnum/GL/Implementation/DebugState.cpp +++ b/src/Magnum/GL/Implementation/DebugState.cpp @@ -51,11 +51,11 @@ DebugState::DebugState(Context& context, Containers::StaticArrayView()) { diff --git a/src/Magnum/GL/Implementation/DebugState.h b/src/Magnum/GL/Implementation/DebugState.h index 6b7c2d61f..be8595aae 100644 --- a/src/Magnum/GL/Implementation/DebugState.h +++ b/src/Magnum/GL/Implementation/DebugState.h @@ -39,12 +39,14 @@ struct DebugState { Containers::String(*getLabelImplementation)(GLenum, GLuint); void(*labelImplementation)(GLenum, GLuint, Containers::StringView); - - void(*messageInsertImplementation)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugOutput::Severity, Containers::StringView); - void(*controlImplementation)(GLenum, GLenum, GLenum, std::initializer_list, bool); void(*callbackImplementation)(DebugOutput::Callback); - void(*pushGroupImplementation)(DebugGroup::Source, UnsignedInt, Containers::StringView); - void(*popGroupImplementation)(); + + /* These are direct pointers to the GL functions, so need a __stdcall on + Windows to compile properly on 32 bits */ + void(APIENTRY *messageInsertImplementation)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*); + void(APIENTRY *controlImplementation)(GLenum, GLenum, GLenum, GLsizei, const GLuint*, GLboolean); + void(APIENTRY *pushGroupImplementation)(GLenum, GLuint, GLsizei, const GLchar*); + void(APIENTRY *popGroupImplementation)(void); GLint maxLabelLength, maxLoggedMessages, maxMessageLength, maxStackDepth; struct MessageCallback { diff --git a/src/Magnum/GL/Implementation/FramebufferState.h b/src/Magnum/GL/Implementation/FramebufferState.h index 3e928995f..85737eb0a 100644 --- a/src/Magnum/GL/Implementation/FramebufferState.h +++ b/src/Magnum/GL/Implementation/FramebufferState.h @@ -100,6 +100,8 @@ struct FramebufferState { void(*renderbufferStorageMultisampleImplementation)(Renderbuffer&, GLsizei, RenderbufferFormat, const Vector2i&); #endif + /* Cannot be a direct pointer to a GL function because the non-robust + version doesn't take the size argument */ void(*readImplementation)(const Range2Di&, PixelFormat, PixelType, std::size_t, GLvoid*); GLuint readBinding, drawBinding, renderbufferBinding;