Mesa (master): Only enable verbose NoOp dispatch if DEBUG is defined

Kristian Høgsberg krh at kemper.freedesktop.org
Mon Jan 4 04:49:42 UTC 2010


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

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Sun Jan  3 23:24:13 2010 -0500

Only enable verbose NoOp dispatch if DEBUG is defined

By default we generate a function per GL entry point to warn if it's
called without a context set.  This is to allow the function to print
it's name in the warning.  By using a generic function that doesn't print
the function name in the non-DEBUG case, we reduce libGL size from
320008 bytes to 283144 bytes (11%).

---

 src/mesa/glapi/glapi.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index 37c6977..84e5a82 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -108,6 +108,8 @@ warn(const char *func)
    return 0;
 }
 
+#ifdef DEBUG
+
 #define KEYWORD1 static
 #define KEYWORD1_ALT static
 #define KEYWORD2 GLAPIENTRY
@@ -121,11 +123,26 @@ warn(const char *func)
 #define RETURN_DISPATCH(func, args, msg)				      \
    return warn(#func);
 
+#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
+
+#else
+
+static void
+NoOpGeneric(void)
+{
+   if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
+       && warning_func) {
+      warning_func(NULL, "GL User Error: calling GL function");
+   }
+}
+
+#define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric
+
+#endif
+
 #define DISPATCH_TABLE_NAME __glapi_noop_table
 #define UNUSED_TABLE_NAME __unused_noop_functions
 
-#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
-
 static GLint NoOpUnused(void)
 {
    return warn("extension function");




More information about the mesa-commit mailing list