Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-09-01 00:13:35 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-01 01:30:36 +0300
commit9d932b426f0db9350a3fe49cd5bcf8b25e7cf8bb (patch)
tree000cf7fba17c21bd28eac5e0190a5531b0640c89 /source/blender/gpu/opengl/gl_debug.cc
parent82a197cc7f74be2e8f4fbe2d40fc2aec100c4276 (diff)
GL: Move MacOS debug callback to gl_debug.cc
And format to use the same callback as standard debugging layer.
Diffstat (limited to 'source/blender/gpu/opengl/gl_debug.cc')
-rw-r--r--source/blender/gpu/opengl/gl_debug.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc
index 1300cf4065e..2dc0835adfb 100644
--- a/source/blender/gpu/opengl/gl_debug.cc
+++ b/source/blender/gpu/opengl/gl_debug.cc
@@ -137,4 +137,42 @@ void init_gl_callbacks(void)
/** \} */
+/* -------------------------------------------------------------------- */
+/** \name Error Checking
+ *
+ * This is only useful for implementation that does not support the KHR_debug extension.
+ * \{ */
+
+void check_gl_error(const char *info)
+{
+ GLenum error = glGetError();
+
+#define ERROR_CASE(err) \
+ case err: { \
+ char msg[256]; \
+ SNPRINTF(msg, "%s : %s", #err, info); \
+ debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); \
+ break; \
+ }
+
+ switch (error) {
+ ERROR_CASE(GL_INVALID_ENUM)
+ ERROR_CASE(GL_INVALID_VALUE)
+ ERROR_CASE(GL_INVALID_OPERATION)
+ ERROR_CASE(GL_INVALID_FRAMEBUFFER_OPERATION)
+ ERROR_CASE(GL_OUT_OF_MEMORY)
+ ERROR_CASE(GL_STACK_UNDERFLOW)
+ ERROR_CASE(GL_STACK_OVERFLOW)
+ case GL_NO_ERROR:
+ break;
+ default:
+ char msg[256];
+ SNPRINTF(msg, "Unknown GL error: %x : %s", error, info);
+ debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL);
+ break;
+ }
+}
+
+/** \} */
+
} // namespace blender::gpu::debug \ No newline at end of file