[core] only load debug extensions in debug mode

This commit is contained in:
Konstantin Käfer
2016-09-28 17:30:01 +02:00
committed by John Firebaugh
parent 2ec2860ce5
commit 8c4da72d09
3 changed files with 17 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
#ifndef NDEBUG
#include <mbgl/gl/debugging.hpp>
#include <mbgl/gl/gl.hpp>
#include <mbgl/gl/extension.hpp>
@@ -189,3 +190,5 @@ group::~group() {
} // namespace debugging
} // namespace gl
} // namespace mbgl
#endif

View File

@@ -1,14 +1,8 @@
#pragma once
#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
#include <string>
namespace mbgl {
namespace gl {
@@ -24,3 +18,13 @@ struct group {
} // namespace debugging
} // namespace gl
} // namespace mbgl
#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 // ifndef NDEBUG
#define MBGL_DEBUG_GROUP(string)
#endif

View File

@@ -40,7 +40,9 @@ using namespace style;
Painter::Painter(const TransformState& state_)
: state(state_) {
#ifndef NDEBUG
gl::debugging::enable();
#endif
shaders = std::make_unique<Shaders>(context);
#ifndef NDEBUG