diff options
author | Adam Jackson <ajax@redhat.com> | 2011-03-02 12:30:22 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2011-03-28 12:46:38 -0400 |
commit | b0c665ac0fe6840dda581e4d0d0b76c703d62a7b (patch) | |
tree | efb27825f7b90a1f6a4de2dd51a2c301a5998be8 /glx/glapi.c | |
parent | a095a6d4e8f5090907e8d3d66018636216300846 (diff) |
glx: Remove noop dispatch table
We can never hit this, because the indirect GLX dispatch code always
forces a current context and checks that it's non-NULL before calling
into the dispatch table. If it's _not_ null, then _glapi_set_context
will call into the driver, which is responsible for calling
_glapi_set_dispatch to make sure the dispatch table is non-NULL.
Also remove _glapi_set_warning_func and friends, since we can no longer
call them even from dead code.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx/glapi.c')
-rw-r--r-- | glx/glapi.c | 92 |
1 files changed, 2 insertions, 90 deletions
diff --git a/glx/glapi.c b/glx/glapi.c index 19576a775..181449331 100644 --- a/glx/glapi.c +++ b/glx/glapi.c @@ -72,11 +72,6 @@ #include "glapioffsets.h" #include "glapitable.h" -/***** BEGIN NO-OP DISPATCH *****/ - -static GLboolean WarnFlag = GL_FALSE; -static _glapi_warning_func warning_func; - #if defined(PTHREADS) || defined(GLX_USE_TLS) static void init_glapi_relocs(void); #endif @@ -84,79 +79,6 @@ static void init_glapi_relocs(void); static _glapi_proc generate_entrypoint(GLuint functionOffset); static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset); -/* - * Enable/disable printing of warning messages. - */ -PUBLIC void -_glapi_noop_enable_warnings(GLboolean enable) -{ - WarnFlag = enable; -} - -/* - * Register a callback function for reporting errors. - */ -PUBLIC void -_glapi_set_warning_func( _glapi_warning_func func ) -{ - warning_func = func; -} - -static GLboolean -warn(void) -{ - if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) - && warning_func) { - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - -#if defined(__GNUC__) && (__GNUC__ > 2) -#define possibly_unused __attribute((unused)) -#else -#define possibly_unused -#endif - -#define KEYWORD1 static -#define KEYWORD1_ALT static -#define KEYWORD2 GLAPIENTRY possibly_unused -#define NAME(func) NoOp##func - -#define F NULL - -#define DISPATCH(func, args, msg) \ - if (warn()) { \ - warning_func(NULL, "GL User Error: called without context: %s", #func); \ - } - -#define RETURN_DISPATCH(func, args, msg) \ - if (warn()) { \ - warning_func(NULL, "GL User Error: called without context: %s", #func); \ - } \ - return 0 - -#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) -{ - if (warn()) { - warning_func(NULL, "GL User Error: calling extension function without a current context\n"); - } - return 0; -} - -#include "glapitemp.h" - -/***** END NO-OP DISPATCH *****/ - - - /** * \name Current dispatch and current context control variables * @@ -185,8 +107,7 @@ static GLint NoOpUnused(void) #if defined(GLX_USE_TLS) PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch - __attribute__((tls_model("initial-exec"))) - = (struct _glapi_table *) __glapi_noop_table; + __attribute__((tls_model("initial-exec"))) = NULL; PUBLIC TLS void * _glapi_tls_Context __attribute__((tls_model("initial-exec"))); @@ -212,8 +133,7 @@ void FreeAllTSD(void) #endif /* defined(THREADS) */ -PUBLIC struct _glapi_table *_glapi_Dispatch = - (struct _glapi_table *) __glapi_noop_table; +PUBLIC struct _glapi_table *_glapi_Dispatch = NULL; PUBLIC void *_glapi_Context = NULL; #endif /* defined(GLX_USE_TLS) */ @@ -252,7 +172,6 @@ _glapi_check_multithread(void) PUBLIC void _glapi_set_context(void *context) { - (void) __unused_noop_functions; /* silence a warning */ #if defined(GLX_USE_TLS) _glapi_tls_Context = context; #elif defined(THREADS) @@ -284,8 +203,6 @@ _glapi_get_context(void) /** * Set the global or per-thread dispatch table pointer. - * If the dispatch parameter is NULL we'll plug in the no-op dispatch - * table (__glapi_noop_table). */ PUBLIC void _glapi_set_dispatch(struct _glapi_table *dispatch) @@ -295,11 +212,6 @@ _glapi_set_dispatch(struct _glapi_table *dispatch) pthread_once( & once_control, init_glapi_relocs ); #endif - if (!dispatch) { - /* use the no-op functions */ - dispatch = (struct _glapi_table *) __glapi_noop_table; - } - #if defined(GLX_USE_TLS) _glapi_tls_Dispatch = dispatch; #elif defined(THREADS) |