summaryrefslogtreecommitdiffstats
path: root/opengl/libs/GLES_CM
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-10-08 15:58:11 -0700
committerMathias Agopian <mathias@google.com>2009-10-08 15:58:11 -0700
commit7d21a745ac7d272400af599c20e2043f22bce28d (patch)
treec77f03088e014e92fa3ea094badc852ab9e6cc84 /opengl/libs/GLES_CM
parent8f2d50521653f24c2a5e77b627dc015c7fbd656a (diff)
downloadframeworks_native-7d21a745ac7d272400af599c20e2043f22bce28d.tar.gz
frameworks_native-7d21a745ac7d272400af599c20e2043f22bce28d.tar.bz2
frameworks_native-7d21a745ac7d272400af599c20e2043f22bce28d.zip
add a way to easily catch and log GL errors (compile time flag)
Diffstat (limited to 'opengl/libs/GLES_CM')
-rw-r--r--opengl/libs/GLES_CM/gl.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 3204d9af9..1e4c13668 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -31,6 +31,9 @@
using namespace android;
+// set this to 1 for crude GL debugging
+#define CHECK_FOR_GL_ERRORS 0
+
// ----------------------------------------------------------------------------
// extensions for the framework
// ----------------------------------------------------------------------------
@@ -71,7 +74,7 @@ void glVertexPointerBounds(GLint size, GLenum type,
#undef CALL_GL_API
#undef CALL_GL_API_RETURN
-#if USE_FAST_TLS_KEY
+#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -95,12 +98,27 @@ void glVertexPointerBounds(GLint size, GLenum type,
#else
+ #if CHECK_FOR_GL_ERRORS
+
+ #define CHECK_GL_ERRORS(_api) \
+ do { GLint err = glGetError(); \
+ LOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \
+ } while(false);
+
+ #else
+
+ #define CHECK_GL_ERRORS(_api) do { } while(false);
+
+ #endif
+
+
#define API_ENTRY(_api) _api
#define CALL_GL_API(_api, ...) \
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- _c->_api(__VA_ARGS__)
-
+ _c->_api(__VA_ARGS__); \
+ CHECK_GL_ERRORS(_api)
+
#define CALL_GL_API_RETURN(_api, ...) \
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
return _c->_api(__VA_ARGS__)