summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/command_encoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/gl/command_encoder.cpp')
-rw-r--r--src/mbgl/gl/command_encoder.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mbgl/gl/command_encoder.cpp b/src/mbgl/gl/command_encoder.cpp
index 82046202bc..e1bf5e1187 100644
--- a/src/mbgl/gl/command_encoder.cpp
+++ b/src/mbgl/gl/command_encoder.cpp
@@ -1,12 +1,43 @@
#include <mbgl/gl/command_encoder.hpp>
#include <mbgl/gl/context.hpp>
+#include <mbgl/gl/debugging_extension.hpp>
+#include <mbgl/platform/gl_functions.hpp>
+
+#include <cstring>
namespace mbgl {
namespace gl {
CommandEncoder::~CommandEncoder() {
+ const auto debugGroup(createDebugGroup("cleanup"));
context.performCleanup();
}
+void CommandEncoder::pushDebugGroup(const char* name) {
+ (void)name;
+#ifndef NDEBUG
+ if (auto debugging = context.getDebuggingExtension()) {
+ if (debugging->pushDebugGroup) {
+ MBGL_CHECK_ERROR(debugging->pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0,
+ platform::GLsizei(strlen(name)), name));
+ } else if (debugging->pushGroupMarkerEXT) {
+ MBGL_CHECK_ERROR(debugging->pushGroupMarkerEXT(platform::GLsizei(strlen(name) + 1), name));
+ }
+ }
+#endif
+}
+
+void CommandEncoder::popDebugGroup() {
+#ifndef NDEBUG
+ if (auto debugging = context.getDebuggingExtension()) {
+ if (debugging->popDebugGroup) {
+ MBGL_CHECK_ERROR(debugging->popDebugGroup());
+ } else if (debugging->popGroupMarkerEXT) {
+ MBGL_CHECK_ERROR(debugging->popGroupMarkerEXT());
+ }
+ }
+#endif
+}
+
} // namespace gl
} // namespace mbgl