summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeith Bade <leith@mapbox.com>2014-12-11 00:09:26 +1100
committerLeith Bade <leith@mapbox.com>2014-12-11 00:09:26 +1100
commitd599fc55043c60c282648ab7ef68b4f29d3ac35c (patch)
tree1b3bcd44e5fa3b384a62c1cdd6261977052fa150 /include
parent6bb1a5a146bcffde0f5f25587413c5fb076890b5 (diff)
parent0c62cd06552597966adb99183eb5ca78901a6087 (diff)
downloadqtlocation-mapboxgl-d599fc55043c60c282648ab7ef68b4f29d3ac35c.tar.gz
Merge branch 'master' of github.com:mapbox/mapbox-gl-native into android-mason
Conflicts: platform/default/glfw_view.cpp platform/default/headless_view.cpp src/mbgl/renderer/painter.cpp src/mbgl/renderer/prerendered_texture.cpp
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/gl.hpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp
index cb0fb4892c..d20d3074b7 100644
--- a/include/mbgl/platform/gl.hpp
+++ b/include/mbgl/platform/gl.hpp
@@ -2,6 +2,7 @@
#define MBGL_RENDERER_GL
#include <string>
+#include <stdexcept>
#if __APPLE__
#include "TargetConditionals.h"
@@ -30,6 +31,12 @@
namespace mbgl {
namespace gl {
+struct Error : ::std::runtime_error {
+ inline Error(GLenum err, const std::string &msg) : ::std::runtime_error(msg), code(err) {};
+ const GLenum code;
+};
+
+
// GL_KHR_debug / GL_ARB_debug_output
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
@@ -180,6 +187,9 @@ struct group {
inline group(const std::string &str) { start_group(str); }
~group() { end_group(); };
};
+
+void checkError(const char *cmd, const char *file, int line);
+
}
}
@@ -188,12 +198,10 @@ struct group {
#define glDepthRange glDepthRangef
#endif
-void _CHECK_GL_ERROR(const char *cmd, const char *file, int line);
-
-#define _CHECK_ERROR(cmd, file, line) \
- cmd; \
- do { _CHECK_GL_ERROR(#cmd, file, line); } while (false);
-
-#define CHECK_ERROR(cmd) _CHECK_ERROR(cmd, __FILE__, __LINE__)
+#if defined(DEBUG)
+#define MBGL_CHECK_ERROR(cmd) ([&]() { struct _ { inline ~_() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } _; return cmd; }())
+#else
+#define MBGL_CHECK_ERROR(cmd) (cmd)
+#endif
#endif