[core] Use NDEBUG instead of DEBUG
CMake defines 'NDEBUG' by default for release build, so we can check if that's not defined instead of using 'DEBUG' for debug build.
This commit is contained in:
committed by
Konstantin Käfer
parent
57bed88b03
commit
3ae506ee13
@@ -66,7 +66,7 @@ struct Error : ::std::runtime_error {
|
||||
|
||||
void checkError(const char *cmd, const char *file, int line);
|
||||
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }())
|
||||
#else
|
||||
#define MBGL_CHECK_ERROR(cmd) (cmd)
|
||||
|
||||
@@ -40,7 +40,7 @@ struct EventPermutation {
|
||||
};
|
||||
|
||||
constexpr EventSeverity disabledEventSeverities[] = {
|
||||
#if DEBUG
|
||||
#ifdef NDEBUG
|
||||
EventSeverity(-1) // Avoid zero size array
|
||||
#else
|
||||
EventSeverity::Debug
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
|
||||
#include <thread>
|
||||
#define MBGL_STORE_THREAD(tid) const std::thread::id tid = std::this_thread::get_id();
|
||||
|
||||
@@ -177,10 +177,6 @@ void GlyphAtlas::upload(gl::ObjectStore& store, gl::Config& config, uint32_t uni
|
||||
}
|
||||
|
||||
dirty = false;
|
||||
|
||||
#if defined(DEBUG)
|
||||
// platform::showDebugImage("Glyph Atlas", reinterpret_cast<char*>(data.get()), width, height);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined(DEBUG)
|
||||
#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);
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
#include <mbgl/util/mat3.hpp>
|
||||
#include <mbgl/util/string.hpp>
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <mbgl/util/stopwatch.hpp>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@@ -46,7 +42,7 @@ Painter::Painter(const TransformState& state_,
|
||||
gl::debugging::enable();
|
||||
|
||||
shaders = std::make_unique<Shaders>(store);
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
overdrawShaders = std::make_unique<Shaders>(store, Shader::Overdraw);
|
||||
#endif
|
||||
|
||||
@@ -71,7 +67,7 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
|
||||
frame = frame_;
|
||||
|
||||
PaintParameters parameters {
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
isOverdraw() ? *overdrawShaders : *shaders
|
||||
#else
|
||||
*shaders
|
||||
@@ -159,7 +155,7 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
|
||||
drawClippingMasks(parameters, generator.getStencils());
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
if (frame.debugOptions & MapDebugOptions::StencilClip) {
|
||||
renderClipMasks();
|
||||
return;
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// Renders the red debug frame around a tile, visualizing its perimeter.
|
||||
void renderDebugFrame(const mat4 &matrix);
|
||||
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
// Renders tile clip boundaries, using stencil buffer to calculate fill color.
|
||||
void renderClipMasks();
|
||||
#endif
|
||||
@@ -142,7 +142,7 @@ private:
|
||||
|
||||
void setDepthSublayer(int n);
|
||||
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
bool isOverdraw() const { return frame.debugOptions & MapDebugOptions::Overdraw; }
|
||||
#else
|
||||
bool isOverdraw() const { return false; }
|
||||
@@ -181,7 +181,7 @@ private:
|
||||
FrameHistory frameHistory;
|
||||
|
||||
std::unique_ptr<Shaders> shaders;
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
std::unique_ptr<Shaders> overdrawShaders;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
|
||||
MBGL_CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)tileBorderBuffer.index()));
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
void Painter::renderClipMasks() {
|
||||
config.stencilTest = GL_FALSE;
|
||||
config.depthTest = GL_FALSE;
|
||||
@@ -123,6 +123,6 @@ void Painter::renderClipMasks() {
|
||||
MBGL_CHECK_ERROR(glDrawPixels(fbSize[0], fbSize[1], GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels.get()));
|
||||
#endif // GL_ES_VERSION_2_0
|
||||
}
|
||||
#endif // defined(DEBUG)
|
||||
#endif // NDEBUG
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace mbgl {
|
||||
|
||||
namespace debug {
|
||||
|
||||
#if defined(DEBUG)
|
||||
#ifndef NDEBUG
|
||||
const bool tileParseWarnings = false;
|
||||
const bool styleParseWarnings = false;
|
||||
const bool spriteWarnings = false;
|
||||
|
||||
Reference in New Issue
Block a user