summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeith Bade <leith@mapbox.com>2014-12-11 00:14:46 +1100
committerLeith Bade <leith@mapbox.com>2014-12-11 00:14:46 +1100
commitdf2ebadaa3c298370fce8d6a84d45b693683503d (patch)
treefe7e8453b363e9bbea7f25ee31127def28eb22dd /include
parentd599fc55043c60c282648ab7ef68b4f29d3ac35c (diff)
downloadqtlocation-mapboxgl-df2ebadaa3c298370fce8d6a84d45b693683503d.tar.gz
Add missing CHECK_ERROR
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/gl.hpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp
index d20d3074b7..140c985042 100644
--- a/include/mbgl/platform/gl.hpp
+++ b/include/mbgl/platform/gl.hpp
@@ -36,6 +36,13 @@ struct Error : ::std::runtime_error {
const GLenum code;
};
+void checkError(const char *cmd, const char *file, int 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
// GL_KHR_debug / GL_ARB_debug_output
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
@@ -162,9 +169,9 @@ extern PFNGLPROGRAMPARAMETERIPROC ProgramParameteri;
// static int indent = 0;
inline void start_group(const std::string &str) {
if (gl::PushDebugGroup != nullptr) {
- gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str());
+ MBGL_CHECK_ERROR(gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str()));
} else if (gl::PushGroupMarkerEXT != nullptr) {
- gl::PushGroupMarkerEXT(GLsizei(str.size()), str.c_str());
+ MBGL_CHECK_ERROR(gl::PushGroupMarkerEXT(GLsizei(str.size()), str.c_str()));
}
// fprintf(stderr, "%s%s\n", std::string(indent * 4, ' ').c_str(), str.c_str());
// indent++;
@@ -172,9 +179,9 @@ inline void start_group(const std::string &str) {
inline void end_group() {
if (gl::PopDebugGroup != nullptr) {
- gl::PopDebugGroup();
+ MBGL_CHECK_ERROR(gl::PopDebugGroup());
} else if (gl::PopGroupMarkerEXT != nullptr) {
- gl::PopGroupMarkerEXT();
+ MBGL_CHECK_ERROR(gl::PopGroupMarkerEXT());
}
// indent--;
}
@@ -188,8 +195,6 @@ struct group {
~group() { end_group(); };
};
-void checkError(const char *cmd, const char *file, int line);
-
}
}
@@ -198,10 +203,4 @@ void checkError(const char *cmd, const char *file, int line);
#define glDepthRange glDepthRangef
#endif
-#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