summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/debugging.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-02-27 18:33:16 +0100
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-03-23 14:50:11 -0700
commite67abfbe67d7c08e90fdbd8727c4e9ed17dfa1ed (patch)
tree8bf1a6ae813afdfe44bd8d6210337141acd53bae /src/mbgl/gl/debugging.hpp
parent234384ece9c70f2a803ed2b1d1eb55b248ec43d1 (diff)
downloadqtlocation-mapboxgl-e67abfbe67d7c08e90fdbd8727c4e9ed17dfa1ed.tar.gz
[core] Refactor OpenGL extension loading mechanism
Previously, we initialized global variables that held pointers to the extension functions. While this seemed to work, the spec doesn't guarantee that the function pointers are identical for different OpenGL contexts. Therefore, we are now making them a member variable of the Context object.
Diffstat (limited to 'src/mbgl/gl/debugging.hpp')
-rw-r--r--src/mbgl/gl/debugging.hpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mbgl/gl/debugging.hpp b/src/mbgl/gl/debugging.hpp
index fe363701ad..d24b727295 100644
--- a/src/mbgl/gl/debugging.hpp
+++ b/src/mbgl/gl/debugging.hpp
@@ -1,26 +1,34 @@
#pragma once
+#include <mbgl/util/noncopyable.hpp>
+
#include <string>
namespace mbgl {
namespace gl {
-namespace debugging {
-void enable();
+class Context;
#ifndef NDEBUG
-struct group {
- group(const std::string&);
- ~group();
+
+class DebugGroup : private util::noncopyable {
+public:
+ DebugGroup(const Context&, const std::string&);
+ ~DebugGroup();
+
+private:
+ const Context& context;
};
#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);
+#define MBGL_DEBUG_GROUP(context, name) const ::mbgl::gl::DebugGroup __MBGL_DEBUG_GROUP_NAME(__LINE__)(context, name);
+
#else
-#define MBGL_DEBUG_GROUP(string)
+
+#define MBGL_DEBUG_GROUP(context, name)
+
#endif
-} // namespace debugging
} // namespace gl
} // namespace mbgl