From 0219d325053e6c7029ae4cedfbeddaefed4fe0e5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Jan 2000 04:29:09 +0000 Subject: added printf-message to dispatch templates --- src/mesa/glapi/glapi.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/mesa/glapi/glapi.c') diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index d9b4dca616..fa74a0d85b 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 + +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 -- cgit v1.2.3