aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLUtil.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-18 12:27:29 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-18 12:27:29 +0000
commit845eafddb09e9a28b45b502abb544df1e286a324 (patch)
tree1313f56914389948085b576817671737995965d4 /src/gpu/gl/GrGLUtil.cpp
parentfc0d23a6ba476c7fac0d0581880a930c1951efa0 (diff)
show meaningful GL error strings during debugging
Committed on behalf of Guanqun.Lu@gmail.com Review URL: http://codereview.appspot.com/6306094/ git-svn-id: http://skia.googlecode.com/svn/trunk@4271 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGLUtil.cpp')
-rw-r--r--src/gpu/gl/GrGLUtil.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 9d854ba5f6..2f22f00f69 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -8,16 +8,37 @@
#include "GrGLUtil.h"
+
void GrGLClearErr(const GrGLInterface* gl) {
while (GR_GL_NO_ERROR != gl->fGetError()) {}
}
+namespace {
+const char *get_error_string(uint32_t err) {
+ switch (err) {
+ case GR_GL_NO_ERROR:
+ return "";
+ case GR_GL_INVALID_ENUM:
+ return "Invalid Enum";
+ case GR_GL_INVALID_VALUE:
+ return "Invalid Value";
+ case GR_GL_INVALID_OPERATION:
+ return "Invalid Operation";
+ case GR_GL_OUT_OF_MEMORY:
+ return "Out of Memory";
+ case GR_GL_CONTEXT_LOST:
+ return "Context Lost";
+ }
+ return "Unknown";
+}
+}
+
void GrGLCheckErr(const GrGLInterface* gl,
const char* location,
const char* call) {
uint32_t err = GR_GL_GET_ERROR(gl);
if (GR_GL_NO_ERROR != err) {
- GrPrintf("---- glGetError %x", err);
+ GrPrintf("---- glGetError 0x%x(%s)", err, get_error_string(err));
if (NULL != location) {
GrPrintf(" at\n\t%s", location);
}