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>
This commit is contained in:
parent
a095a6d4e8
commit
b0c665ac0f
|
@ -41,7 +41,6 @@ glapi_sources = \
|
||||||
indirect_table.c \
|
indirect_table.c \
|
||||||
dispatch.h \
|
dispatch.h \
|
||||||
glapitable.h \
|
glapitable.h \
|
||||||
glapitemp.h \
|
|
||||||
glapi.c \
|
glapi.c \
|
||||||
glapi.h \
|
glapi.h \
|
||||||
glapioffsets.h \
|
glapioffsets.h \
|
||||||
|
|
92
glx/glapi.c
92
glx/glapi.c
|
@ -72,11 +72,6 @@
|
||||||
#include "glapioffsets.h"
|
#include "glapioffsets.h"
|
||||||
#include "glapitable.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)
|
#if defined(PTHREADS) || defined(GLX_USE_TLS)
|
||||||
static void init_glapi_relocs(void);
|
static void init_glapi_relocs(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,79 +79,6 @@ static void init_glapi_relocs(void);
|
||||||
static _glapi_proc generate_entrypoint(GLuint functionOffset);
|
static _glapi_proc generate_entrypoint(GLuint functionOffset);
|
||||||
static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset);
|
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
|
* \name Current dispatch and current context control variables
|
||||||
*
|
*
|
||||||
|
@ -185,8 +107,7 @@ static GLint NoOpUnused(void)
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
|
|
||||||
PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch
|
PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch
|
||||||
__attribute__((tls_model("initial-exec")))
|
__attribute__((tls_model("initial-exec"))) = NULL;
|
||||||
= (struct _glapi_table *) __glapi_noop_table;
|
|
||||||
|
|
||||||
PUBLIC TLS void * _glapi_tls_Context
|
PUBLIC TLS void * _glapi_tls_Context
|
||||||
__attribute__((tls_model("initial-exec")));
|
__attribute__((tls_model("initial-exec")));
|
||||||
|
@ -212,8 +133,7 @@ void FreeAllTSD(void)
|
||||||
|
|
||||||
#endif /* defined(THREADS) */
|
#endif /* defined(THREADS) */
|
||||||
|
|
||||||
PUBLIC struct _glapi_table *_glapi_Dispatch =
|
PUBLIC struct _glapi_table *_glapi_Dispatch = NULL;
|
||||||
(struct _glapi_table *) __glapi_noop_table;
|
|
||||||
PUBLIC void *_glapi_Context = NULL;
|
PUBLIC void *_glapi_Context = NULL;
|
||||||
|
|
||||||
#endif /* defined(GLX_USE_TLS) */
|
#endif /* defined(GLX_USE_TLS) */
|
||||||
|
@ -252,7 +172,6 @@ _glapi_check_multithread(void)
|
||||||
PUBLIC void
|
PUBLIC void
|
||||||
_glapi_set_context(void *context)
|
_glapi_set_context(void *context)
|
||||||
{
|
{
|
||||||
(void) __unused_noop_functions; /* silence a warning */
|
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
_glapi_tls_Context = context;
|
_glapi_tls_Context = context;
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
|
@ -284,8 +203,6 @@ _glapi_get_context(void)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the global or per-thread dispatch table pointer.
|
* 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
|
PUBLIC void
|
||||||
_glapi_set_dispatch(struct _glapi_table *dispatch)
|
_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 );
|
pthread_once( & once_control, init_glapi_relocs );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!dispatch) {
|
|
||||||
/* use the no-op functions */
|
|
||||||
dispatch = (struct _glapi_table *) __glapi_noop_table;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
_glapi_tls_Dispatch = dispatch;
|
_glapi_tls_Dispatch = dispatch;
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
|
|
|
@ -106,12 +106,6 @@ extern struct _glapi_table *_glapi_Dispatch;
|
||||||
** GL API public functions
|
** GL API public functions
|
||||||
**/
|
**/
|
||||||
|
|
||||||
extern void
|
|
||||||
_glapi_noop_enable_warnings(GLboolean enable);
|
|
||||||
|
|
||||||
extern void
|
|
||||||
_glapi_set_warning_func(_glapi_warning_func func);
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_glapi_check_multithread(void);
|
_glapi_check_multithread(void);
|
||||||
|
|
||||||
|
|
6655
glx/glapitemp.h
6655
glx/glapitemp.h
File diff suppressed because it is too large
Load Diff
|
@ -681,17 +681,8 @@ GLuint __glFloorLog2(GLuint val)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void warn_func(void * p1, char *format, ...) {
|
|
||||||
va_list v;
|
|
||||||
va_start(v, format);
|
|
||||||
vfprintf(stderr, format, v);
|
|
||||||
va_end(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setup_dispatch_table(void) {
|
static void setup_dispatch_table(void) {
|
||||||
struct _glapi_table *disp=_glapi_get_dispatch();
|
struct _glapi_table *disp=_glapi_get_dispatch();
|
||||||
_glapi_set_warning_func((_glapi_warning_func)warn_func);
|
|
||||||
_glapi_noop_enable_warnings(TRUE);
|
|
||||||
|
|
||||||
/* to update:
|
/* to update:
|
||||||
* for f in $(grep 'define SET_' ../../../glx/dispatch.h | cut -f2 -d' ' | cut -f1 -d\( | sort -u); do grep -q $f indirect.c || echo $f ; done | grep -v by_offset | sed 's:SET_\(.*\)$:SET_\1(disp, gl\1)\;:' | pbcopy
|
* for f in $(grep 'define SET_' ../../../glx/dispatch.h | cut -f2 -d' ' | cut -f1 -d\( | sort -u); do grep -q $f indirect.c || echo $f ; done | grep -v by_offset | sed 's:SET_\(.*\)$:SET_\1(disp, gl\1)\;:' | pbcopy
|
||||||
|
|
Loading…
Reference in New Issue