diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-01-17 08:27:51 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-01-17 14:45:29 -0600 |
commit | b04e11b5ca377e288b9ad27406603e4e1076a375 (patch) | |
tree | b69037a0260a740e85abc881b3692c8b23914389 | |
parent | ed80755084a3ab68a4f950e1a2aad8bda2bbe3f7 (diff) | |
download | qtlocation-mapboxgl-b04e11b5ca377e288b9ad27406603e4e1076a375.tar.gz |
[core] Disable debug groups in release builds
-rw-r--r-- | src/mbgl/gl/debugging.cpp | 58 | ||||
-rw-r--r-- | src/mbgl/gl/debugging.hpp | 16 |
2 files changed, 38 insertions, 36 deletions
diff --git a/src/mbgl/gl/debugging.cpp b/src/mbgl/gl/debugging.cpp index 07d1156334..f99308de7e 100644 --- a/src/mbgl/gl/debugging.cpp +++ b/src/mbgl/gl/debugging.cpp @@ -80,34 +80,6 @@ static ExtensionFunction< {"GL_ARB_debug_output", "glDebugMessageCallbackARB"} }); -static ExtensionFunction< - void (GLenum source, - GLuint id, - GLsizei length, - const GLchar *message)> - PushDebugGroup({ - {"GL_KHR_debug", "glPushDebugGroup"} - }); - -static ExtensionFunction< - void ()> - PopDebugGroup({ - {"GL_KHR_debug", "glPopDebugGroup"} - }); - -static ExtensionFunction< - void (GLsizei length, - const GLchar *marker)> - PushGroupMarkerEXT({ - {"GL_EXT_debug_marker", "glPushGroupMarkerEXT"} - }); - -static ExtensionFunction< - void ()> - PopGroupMarkerEXT({ - {"GL_EXT_debug_marker", "glPopGroupMarkerEXT"} - }); - void debugCallback(GLenum source, GLenum type, GLuint id, @@ -170,6 +142,35 @@ void enable() { MBGL_CHECK_ERROR(DebugMessageCallback(debugCallback, nullptr)); } +#ifndef NDEBUG +static ExtensionFunction< + void (GLenum source, + GLuint id, + GLsizei length, + const GLchar *message)> + PushDebugGroup({ + {"GL_KHR_debug", "glPushDebugGroup"} + }); + +static ExtensionFunction< + void ()> + PopDebugGroup({ + {"GL_KHR_debug", "glPopDebugGroup"} + }); + +static ExtensionFunction< + void (GLsizei length, + const GLchar *marker)> + PushGroupMarkerEXT({ + {"GL_EXT_debug_marker", "glPushGroupMarkerEXT"} + }); + +static ExtensionFunction< + void ()> + PopGroupMarkerEXT({ + {"GL_EXT_debug_marker", "glPopGroupMarkerEXT"} + }); + group::group(const std::string& str) { if (PushDebugGroup) { PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str()); @@ -185,6 +186,7 @@ group::~group() { PopGroupMarkerEXT(); } } +#endif } // namespace debugging } // namespace gl diff --git a/src/mbgl/gl/debugging.hpp b/src/mbgl/gl/debugging.hpp index 06b47a4192..fe363701ad 100644 --- a/src/mbgl/gl/debugging.hpp +++ b/src/mbgl/gl/debugging.hpp @@ -2,25 +2,25 @@ #include <string> -#ifndef NDEBUG -#define __MBGL_DEBUG_GROUP_NAME2(counter) __MBGL_DEBUG_GROUP_##counter -#define __MBGL_DEBUG_GROUP_NAME(counter) __MBGL_DEBUG_GROUP_NAME2(counter) -#define MBGL_DEBUG_GROUP(string) ::mbgl::gl::debugging::group __MBGL_DEBUG_GROUP_NAME(__LINE__)(string); -#else -#define MBGL_DEBUG_GROUP(string) -#endif - namespace mbgl { namespace gl { namespace debugging { void enable(); +#ifndef NDEBUG struct group { group(const std::string&); ~group(); }; +#define __MBGL_DEBUG_GROUP_NAME2(counter) __MBGL_DEBUG_GROUP_##counter +#define __MBGL_DEBUG_GROUP_NAME(counter) __MBGL_DEBUG_GROUP_NAME2(counter) +#define MBGL_DEBUG_GROUP(string) ::mbgl::gl::debugging::group __MBGL_DEBUG_GROUP_NAME(__LINE__)(string); +#else +#define MBGL_DEBUG_GROUP(string) +#endif + } // namespace debugging } // namespace gl } // namespace mbgl |