summaryrefslogtreecommitdiffstats
path: root/src/mesa/glapi/glapi.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-01-10 04:29:09 +0000
committerBrian Paul <[email protected]>2000-01-10 04:29:09 +0000
commit0219d325053e6c7029ae4cedfbeddaefed4fe0e5 (patch)
treef97ded621d866352a0bdb72da0ab40cb692788fc /src/mesa/glapi/glapi.c
parent45691208ff4b53944d9ace923e73989377d64b77 (diff)
added printf-message to dispatch templates
Diffstat (limited to 'src/mesa/glapi/glapi.c')
-rw-r--r--src/mesa/glapi/glapi.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index d9b4dca6165..fa74a0d85b5 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -1,4 +1,4 @@
-/* $Id: glapi.c,v 1.21 2000/01/08 11:01:25 brianp Exp $ */
+/* $Id: glapi.c,v 1.22 2000/01/10 04:29:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -502,16 +502,45 @@ _glapi_check_table(const struct _glapi_table *table)
#define NAME(func) gl##func
#endif
-#define DISPATCH(FUNC, ARGS) \
+#ifdef DEBUG
+
+#include <stdio.h>
+
+static int
+trace(void)
+{
+ static int trace = -1;
+ if (trace < 0)
+ trace = getenv("MESA_TRACE") ? 1 : 0;
+ return trace > 0;
+}
+
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+ const struct _glapi_table *dispatch; \
+ dispatch = Dispatch ? Dispatch : _glapi_get_dispatch(); \
+ if (trace()) printf MESSAGE; \
+ (dispatch->FUNC) ARGS
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ const struct _glapi_table *dispatch; \
+ dispatch = Dispatch ? Dispatch : _glapi_get_dispatch(); \
+ if (trace()) printf MESSAGE; \
+ return (dispatch->FUNC) ARGS
+
+#else
+
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
const struct _glapi_table *dispatch; \
dispatch = Dispatch ? Dispatch : _glapi_get_dispatch(); \
(dispatch->FUNC) ARGS
-#define RETURN_DISPATCH(FUNC, ARGS) \
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
const struct _glapi_table *dispatch; \
dispatch = Dispatch ? Dispatch : _glapi_get_dispatch(); \
return (dispatch->FUNC) ARGS
+#endif
+
#ifndef GLAPIENTRY
#define GLAPIENTRY