[Mesa-dev] [PATCH 14/14] mesa: Remove the special enum for _mesa_error debug output.

Eric Anholt eric at anholt.net
Fri Feb 22 19:52:23 PST 2013


Now all the per-message enums from mtypes are gone.  Note that in this
case, as in a few others in the series, it would be nice to see the
"static GLuint msg_id" moved to the caller of some error-generating
function.  I know this can be done with #defines on gcc, but I think it
may be non-portable, which is why I haven't.
---
 src/mesa/main/errors.c |   10 ++++++++--
 src/mesa/main/mtypes.h |    4 ----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 405ee82..97f1b8a 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -927,12 +927,18 @@ void
 _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
 {
    GLboolean do_output, do_log;
+   /* Ideally this would be set up by the caller, so that we had proper IDs
+    * per different message.
+    */
+   static GLuint error_msg_id = 0;
+
+   debug_get_id(&error_msg_id);
 
    do_output = should_output(ctx, error, fmtString);
    do_log = should_log(ctx,
                        MESA_DEBUG_SOURCE_API,
                        MESA_DEBUG_TYPE_ERROR,
-                       API_ERROR_UNKNOWN,
+                       error_msg_id,
                        MESA_DEBUG_SEVERITY_HIGH);
 
    if (do_output || do_log) {
@@ -969,7 +975,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
          _mesa_log_msg(ctx,
                        MESA_DEBUG_SOURCE_API,
                        MESA_DEBUG_TYPE_ERROR,
-                       API_ERROR_UNKNOWN,
+                       error_msg_id,
                        MESA_DEBUG_SEVERITY_HIGH, len, s2);
       }
    }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 11242a8..e45b409 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3398,10 +3398,6 @@ struct gl_debug_msg
    GLcharARB *message;
 };
 
-typedef enum {
-   API_ERROR_UNKNOWN,
-} gl_api_error;
-
 struct gl_debug_namespace
 {
    struct _mesa_HashTable *IDs;
-- 
1.7.10.4



More information about the mesa-dev mailing list