diff options
author | Brian Paul <[email protected]> | 2010-01-22 09:35:12 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-01-22 09:56:55 -0700 |
commit | e4f168a6f4911a096be97d2e83ef8ad9c5862ec0 (patch) | |
tree | 6bc80c976146dd14234872a399095c5dd676fc7c /src | |
parent | 126aff18aaf7512dfe07e4fd43e21a2ecd3a96ff (diff) |
glapi: clean-up and simplify glapi_nop.c code
Removed _glapi_noop_enable_warnings() and _glapi_set_warning_func().
Just check the DEBUG env vars and call fprintf(stderr) with a warning
message instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/glapi/glapi.h | 8 | ||||
-rw-r--r-- | src/mesa/glapi/glapi_nop.c | 79 | ||||
-rw-r--r-- | src/mesa/main/context.c | 8 |
3 files changed, 25 insertions, 70 deletions
diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h index 5fb5401229a..47ea23e92b5 100644 --- a/src/mesa/glapi/glapi.h +++ b/src/mesa/glapi/glapi.h @@ -55,8 +55,6 @@ struct _glapi_table; typedef void (*_glapi_proc)(void); /* generic function pointer */ -typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); - #if defined(USE_MGL_NAMESPACE) #define _glapi_set_dispatch _mglapi_set_dispatch @@ -107,12 +105,6 @@ extern struct _glapi_table *_glapi_Dispatch; **/ extern void -_glapi_noop_enable_warnings(GLboolean enable); - -extern void -_glapi_set_warning_func(_glapi_warning_func func); - -extern void _glapi_check_multithread(void); diff --git a/src/mesa/glapi/glapi_nop.c b/src/mesa/glapi/glapi_nop.c index a0d4b65f55f..e45faef72d4 100644 --- a/src/mesa/glapi/glapi_nop.c +++ b/src/mesa/glapi/glapi_nop.c @@ -42,78 +42,49 @@ #include "glapi/glapi.h" -static GLboolean WarnFlag = GL_FALSE; -static _glapi_warning_func warning_func; - -/* - * Enable/disable printing of warning messages. - */ -PUBLIC void -_glapi_noop_enable_warnings(GLboolean enable) -{ - WarnFlag = enable; -} - -/* - * Register a callback function for reporting errors. +/** + * Called by each of the no-op GL entrypoints. */ -PUBLIC void -_glapi_set_warning_func( _glapi_warning_func func ) -{ - warning_func = func; -} - - static int -warn(const char *func) +Warn(const char *func) { #if !defined(_WIN32_WCE) - if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) - && warning_func) { - warning_func(NULL, "GL User Error: called without context: %s", func); + if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { + fprintf(stderr, "GL User Error: gl%s called without a rendering context\n", + func); } #endif - return 0; + return 0; +} + + +/** + * This is called if the user somehow calls an unassigned GL dispatch function. + */ +static GLint +NoOpUnused(void) +{ + return Warn(" function"); } -#ifdef DEBUG +/* + * Defines for the glapitemp.h functions. + */ #define KEYWORD1 static #define KEYWORD1_ALT static #define KEYWORD2 GLAPIENTRY #define NAME(func) NoOp##func -#define F NULL - -#define DISPATCH(func, args, msg) \ - warn(#func); +#define DISPATCH(func, args, msg) Warn(#func); +#define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0 -#define RETURN_DISPATCH(func, args, msg) \ - warn(#func); return 0 +/* + * Defines for the table of no-op entry points. + */ #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 -static int NoOpUnused(void) -{ - return warn("extension function"); -} #include "glapi/glapitemp.h" diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 320c59068cc..a570506d57b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -415,14 +415,6 @@ one_time_init( GLcontext *ctx ) _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; } - if (_mesa_getenv("MESA_DEBUG")) { - _glapi_noop_enable_warnings(GL_TRUE); - _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); - } - else { - _glapi_noop_enable_warnings(GL_FALSE); - } - #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", MESA_VERSION_STRING, __DATE__, __TIME__); |