diff options
author | Brian Paul <[email protected]> | 2001-03-28 17:19:58 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-03-28 17:19:58 +0000 |
commit | 3c257e187bded9417d00471286d86ea4e483a98a (patch) | |
tree | a143a2de409689910ae0db8818aae4b09fdb318b /src/mesa/main/dispatch.c | |
parent | fb8af6fc9780e6238c309487d265822fc7052a0d (diff) |
New mechanism for thread-safe GL API dispatch. C-based dispatch is faster.
Folded glapinoop.c code into glapi.c.
Added code to glapitemp.h to fill in dispatch tables.
Updated Makefiles.
Diffstat (limited to 'src/mesa/main/dispatch.c')
-rw-r--r-- | src/mesa/main/dispatch.c | 65 |
1 files changed, 11 insertions, 54 deletions
diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 0b9b17effc0..cc14c4b498d 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.21 2001/03/26 23:36:51 brianp Exp $ */ +/* $Id: dispatch.c,v 1.22 2001/03/28 17:20:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -28,9 +28,7 @@ /* * This file generates all the gl* function entyrpoints. * But if we're using X86-optimized dispatch (X86/glapi_x86.S) then - * each of the entrypoints will be prefixed with _glapi_fallback_* - * and will be called by the glapi_x86.S code when we're in thread- - * safe mode. + * we don't use this file's code. * * Eventually this file may be replaced by automatically generated * code from an API spec file. @@ -41,7 +39,6 @@ */ - #ifdef PC_HEADER #include "all.h" #else @@ -51,64 +48,21 @@ #include "glthread.h" #endif - +#if !defined(USE_X86_ASM) #define KEYWORD1 #define KEYWORD2 GLAPIENTRY -#if defined(USE_X86_ASM) && !defined(__WIN32__) && !defined(XF86DRI) -#define NAME(func) _glapi_fallback_##func -#elif defined(USE_MGL_NAMESPACE) +#if defined(USE_MGL_NAMESPACE) #define NAME(func) mgl##func #else #define NAME(func) gl##func #endif -#ifdef DEBUG - -#if 0 -static int -trace(void) -{ - static int trace = -1; - if (trace < 0) - trace = getenv("MESA_TRACE") ? 1 : 0; - return trace > 0; -} -#endif - -#define F stderr - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - (dispatch->FUNC) ARGS - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - return (dispatch->FUNC) ARGS - -#if 0 - /* From both macros above... */ - if (trace()) { \ - fprintf MESSAGE; \ - fprintf(F, "\n"); \ - } -#endif - -#else - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - (dispatch->FUNC) ARGS +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + (_glapi_Dispatch->FUNC) ARGS -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ - return (dispatch->FUNC) ARGS - -#endif +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + return (_glapi_Dispatch->FUNC) ARGS #ifndef GLAPIENTRY @@ -116,3 +70,6 @@ trace(void) #endif #include "glapitemp.h" + + +#endif /* USE_X86_ASM */ |