[1/4] wined3d: Output pretty GL errors in checkGLcall and vcheckGLcall

H. Verbeet hverbeet at gmail.com
Mon Apr 23 15:02:50 CDT 2007


This also makes debugging a little bit easier.

Changelog:
  - Output pretty GL errors in checkGLcall and vcheckGLcall
-------------- next part --------------
---

 dlls/wined3d/utils.c           |   18 ++++++++++++++++++
 dlls/wined3d/wined3d_private.h |    9 +++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 8817fd0..b39f648 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -714,6 +714,24 @@ const char *debug_fbostatus(GLenum status) {
     }
 }
 
+const char *debug_glerror(GLenum error) {
+    switch(error) {
+#define GLERROR_TO_STR(u) case u: return #u
+        GLERROR_TO_STR(GL_NO_ERROR);
+        GLERROR_TO_STR(GL_INVALID_ENUM);
+        GLERROR_TO_STR(GL_INVALID_VALUE);
+        GLERROR_TO_STR(GL_INVALID_OPERATION);
+        GLERROR_TO_STR(GL_STACK_OVERFLOW);
+        GLERROR_TO_STR(GL_STACK_UNDERFLOW);
+        GLERROR_TO_STR(GL_OUT_OF_MEMORY);
+        GLERROR_TO_STR(GL_INVALID_FRAMEBUFFER_OPERATION_EXT);
+#undef GLERROR_TO_STR
+        default:
+            FIXME("Unrecognied GL error 0x%08x\n", error);
+            return "unrecognized";
+    }
+}
+
 /*****************************************************************************
  * Useful functions mapping GL <-> D3D values
  */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d51e15c..88174ca 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -272,8 +272,8 @@ extern int num_lock;
        TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__);    \
                                                                 \
     } else do {                                                 \
-       FIXME(">>>>>>>>>>>>>>>>> %#x from %s @ %s / %d\n",       \
-        err, A, __FILE__, __LINE__);                            \
+        FIXME(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n", \
+            debug_glerror(err), err, A, __FILE__, __LINE__);    \
        err = glGetError();                                      \
     } while (err != GL_NO_ERROR);                               \
 } 
@@ -357,8 +357,8 @@ extern const float identity[16];
        VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
                                                                 \
     } else do {                                                 \
-       FIXME(">>>>>>>>>>>>>>>>> %#x from %s @ %s / %d\n",       \
-                err, A, __FILE__, __LINE__);                    \
+        FIXME(">>>>>>>>>>>>>>>>> %s (%#x) from %s @ %s / %d\n", \
+            debug_glerror(err), err, A, __FILE__, __LINE__);    \
        err = glGetError();                                      \
     } while (err != GL_NO_ERROR);                               \
 }
@@ -1403,6 +1403,7 @@ const char* debug_d3dtexturestate(DWORD state);
 const char* debug_d3dtstype(WINED3DTRANSFORMSTATETYPE tstype);
 const char* debug_d3dpool(WINED3DPOOL pool);
 const char *debug_fbostatus(GLenum status);
+const char *debug_glerror(GLenum error);
 
 /* Routines for GL <-> D3D values */
 GLenum StencilOp(DWORD op);


More information about the wine-patches mailing list