Mesa (master): mesa: print enum name instead of hexadecimal value in glGet errors

Brian Paul brianp at kemper.freedesktop.org
Fri May 14 14:25:44 UTC 2010


Module: Mesa
Branch: master
Commit: 1fbb50b740e9ca97cae13c7cc86505aa21e08e4c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1fbb50b740e9ca97cae13c7cc86505aa21e08e4c

Author: Brian Paul <brianp at vmware.com>
Date:   Fri May 14 08:25:25 2010 -0600

mesa: print enum name instead of hexadecimal value in glGet errors

---

 src/mesa/main/get.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index d2dcddd..f3b4b7b 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -25,6 +25,7 @@
 #include "glheader.h"
 #include "context.h"
 #include "enable.h"
+#include "enums.h"
 #include "extensions.h"
 #include "get.h"
 #include "macros.h"
@@ -1678,7 +1679,8 @@ check_extra(GLcontext *ctx, const char *func, const struct value_desc *d)
       }
 
    if (total > 0 && enabled == 0) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, d->pname);
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
+                  _mesa_lookup_enum_by_nr(d->pname));
       return GL_FALSE;
    }
 
@@ -1727,7 +1729,8 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
       /* If the enum isn't valid, the hash walk ends with index 0,
        * which is the API mask entry at the beginning of values[]. */
       if (d->type == TYPE_API_MASK) {
-	 _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
+	 _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
+                     _mesa_lookup_enum_by_nr(pname));
 	 return &error_value;
       }
       hash += prime_step;
@@ -2256,10 +2259,12 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
    }
 
  invalid_enum:
-   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
+   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
+               _mesa_lookup_enum_by_nr(pname));
    return TYPE_INVALID;
  invalid_value:
-   _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=0x%x)", func, pname);
+   _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=%s)", func,
+               _mesa_lookup_enum_by_nr(pname));
    return TYPE_INVALID;
 }
 




More information about the mesa-commit mailing list