diff options
author | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2010-09-02 18:31:49 +0200 |
---|---|---|
committer | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2010-09-02 18:31:49 +0200 |
commit | 222d2f2ac2c7d93cbc0643082c78278ad2c8cfce (patch) | |
tree | b79152c238022b2a901201c22e5809ac520732bf /src/mapi | |
parent | 443abc80db9e1a288ce770e76cccd43664348098 (diff) | |
parent | e73c5501b2fe20290d1b691c85a5d82ac3a0431c (diff) |
Merge remote branch 'origin/master' into nv50-compiler
Conflicts:
src/gallium/drivers/nv50/nv50_program.c
Diffstat (limited to 'src/mapi')
-rw-r--r-- | src/mapi/glapi/gen/glX_proto_send.py | 6 | ||||
-rw-r--r-- | src/mapi/glapi/glapi.h | 116 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_dispatch.c | 11 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_entrypoint.c | 9 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_getproc.c | 9 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_nop.c | 21 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_priv.h | 25 | ||||
-rw-r--r-- | src/mapi/glapi/glthread.c | 2 | ||||
-rw-r--r-- | src/mapi/glapi/glthread.h | 5 | ||||
-rw-r--r-- | src/mapi/mapi/entry_x86-64_tls.h | 4 | ||||
-rw-r--r-- | src/mapi/mapi/entry_x86_tls.h | 2 | ||||
-rw-r--r-- | src/mapi/mapi/entry_x86_tsd.h | 4 | ||||
-rw-r--r-- | src/mapi/mapi/mapi.h | 22 | ||||
-rw-r--r-- | src/mapi/mapi/u_current.c | 93 | ||||
-rw-r--r-- | src/mapi/mapi/u_current.h | 91 | ||||
-rw-r--r-- | src/mapi/vgapi/SConscript | 1 |
16 files changed, 256 insertions, 165 deletions
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index 0ca0ff92a6..bd41c9e667 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -895,13 +895,13 @@ static int NoOp(void) * Create and initialize a new GL dispatch table. The table is initialized * with GLX indirect rendering protocol functions. */ -__GLapi * __glXNewIndirectAPI( void ) +struct _glapi_table * __glXNewIndirectAPI( void ) { - __GLapi *glAPI; + struct _glapi_table *glAPI; GLuint entries; entries = _glapi_get_dispatch_table_size(); - glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *)); + glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); /* first, set all entries to point to no-op functions */ { diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index a74884d595..a0bb078106 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -44,10 +44,30 @@ #ifndef _GLAPI_H #define _GLAPI_H -#ifndef MAPI_GLAPI_CURRENT -#define MAPI_GLAPI_CURRENT + +/* opengl.dll does not export _glapi_* */ +#if defined(_WIN32) +#define _GLAPI_NO_EXPORTS #endif +#ifdef _GLAPI_NO_EXPORTS +# define _GLAPI_EXPORT +#else /* _GLAPI_NO_EXPORTS */ +# ifdef _WIN32 +# ifdef _GLAPI_DLL_EXPORTS +# define _GLAPI_EXPORT __declspec(dllexport) +# else +# define _GLAPI_EXPORT __declspec(dllimport) +# endif +# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define _GLAPI_EXPORT __attribute__((visibility("default"))) +# else +# define _GLAPI_EXPORT +# endif +#endif /* _GLAPI_NO_EXPORTS */ + + +/* Is this needed? It is incomplete anyway. */ #ifdef USE_MGL_NAMESPACE #define _glapi_set_dispatch _mglapi_set_dispatch #define _glapi_get_dispatch _mglapi_get_dispatch @@ -57,32 +77,106 @@ #define _glapi_Context _mglapi_Context #endif -#include "mapi/u_current.h" #include "glapi/glthread.h" typedef void (*_glapi_proc)(void); +struct _glapi_table; + + +#if defined (GLX_USE_TLS) + +_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))); + +_GLAPI_EXPORT extern __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern const void *_glapi_Context; + +# define GET_DISPATCH() _glapi_tls_Dispatch +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context + +#else + +_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern void *_glapi_Context; + +# ifdef THREADS + +# define GET_DISPATCH() \ + (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) + +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \ + (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context()) + +# else + +# define GET_DISPATCH() _glapi_Dispatch +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context + +# endif + +#endif /* defined (GLX_USE_TLS) */ + + +void +_glapi_destroy_multithread(void); + -#define GET_DISPATCH() ((struct _glapi_table *) u_current_get()) -#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) u_current_get_user() +_GLAPI_EXPORT void +_glapi_check_multithread(void); -PUBLIC unsigned int + +_GLAPI_EXPORT void +_glapi_set_context(void *context); + + +_GLAPI_EXPORT void * +_glapi_get_context(void); + + +_GLAPI_EXPORT void +_glapi_set_dispatch(struct _glapi_table *dispatch); + + +_GLAPI_EXPORT struct _glapi_table * +_glapi_get_dispatch(void); + + +_GLAPI_EXPORT unsigned int _glapi_get_dispatch_table_size(void); -PUBLIC int +_GLAPI_EXPORT int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ); -PUBLIC int +_GLAPI_EXPORT int _glapi_get_proc_offset(const char *funcName); -PUBLIC _glapi_proc +_GLAPI_EXPORT _glapi_proc _glapi_get_proc_address(const char *funcName); -PUBLIC const char * +_GLAPI_EXPORT const char * _glapi_get_proc_name(unsigned int offset); -#endif +_GLAPI_EXPORT unsigned long +_glthread_GetID(void); + + +/* + * These stubs are kept so that the old DRI drivers still load. + */ +_GLAPI_EXPORT void +_glapi_noop_enable_warnings(unsigned char enable); + + +_GLAPI_EXPORT void +_glapi_set_warning_func(_glapi_proc func); + + +#endif /* _GLAPI_H */ diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index ae59140ad3..7421a36d35 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -37,18 +37,9 @@ * \author Brian Paul <brian@precisioninsight.com> */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" +#include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapidispatch.h" -#include "glapi/glthread.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c index 82c68c27c8..993ccb94c2 100644 --- a/src/mapi/glapi/glapi_entrypoint.c +++ b/src/mapi/glapi/glapi_entrypoint.c @@ -29,15 +29,6 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" #include "glapi/glapi_priv.h" #include "mapi/u_execmem.h" diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c index 3c134f929d..dc4905b64e 100644 --- a/src/mapi/glapi/glapi_getproc.c +++ b/src/mapi/glapi/glapi_getproc.c @@ -30,15 +30,6 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" #include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapioffsets.h" diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index 9709551ee7..9b09297150 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -38,28 +38,11 @@ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/compiler.h" -#include "main/glheader.h" -#endif - -#include "glapi/glapi.h" - - -/* - * These stubs are kept so that the old DRI drivers still load. - */ -PUBLIC void -_glapi_noop_enable_warnings(GLboolean enable); +#include "glapi/glapi_priv.h" -PUBLIC void -_glapi_set_warning_func(_glapi_proc func); void -_glapi_noop_enable_warnings(GLboolean enable) +_glapi_noop_enable_warnings(unsigned char enable) { } diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h index 1c2a704211..89f81c723e 100644 --- a/src/mapi/glapi/glapi_priv.h +++ b/src/mapi/glapi/glapi_priv.h @@ -26,9 +26,30 @@ #ifndef _GLAPI_PRIV_H #define _GLAPI_PRIV_H -#include "glthread.h" -#include "glapi.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#include "glapi/mesa.h" +#else /* HAVE_DIX_CONFIG_H */ +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +#ifndef GL_FIXED +typedef int GLfixed; +typedef int GLclampx; +#endif + +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; +#endif + +#endif /* HAVE_DIX_CONFIG_H */ +#include "glapi/glapi.h" /* getproc */ diff --git a/src/mapi/glapi/glthread.c b/src/mapi/glapi/glthread.c index 9dbc0e9a56..00915380f9 100644 --- a/src/mapi/glapi/glthread.c +++ b/src/mapi/glapi/glthread.c @@ -1,4 +1,4 @@ -#include "glthread.h" +#include "glapi/glapi.h" unsigned long _glthread_GetID(void) diff --git a/src/mapi/glapi/glthread.h b/src/mapi/glapi/glthread.h index 54292706ac..fc4ece7c33 100644 --- a/src/mapi/glapi/glthread.h +++ b/src/mapi/glapi/glthread.h @@ -17,7 +17,4 @@ typedef struct u_tsd _glthread_TSD; typedef u_mutex _glthread_Mutex; -PUBLIC unsigned long -_glthread_GetID(void); - -#endif /* THREADS_H */ +#endif /* GLTHREAD_H */ diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h index d4c9907b89..0f6e8125e8 100644 --- a/src/mapi/mapi/entry_x86-64_tls.h +++ b/src/mapi/mapi/entry_x86-64_tls.h @@ -33,7 +33,7 @@ __asm__(".text"); __asm__("x86_64_current_tls:\n\t" - "movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" + "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" "ret"); #define STUB_ASM_ENTRY(func) \ @@ -43,7 +43,7 @@ __asm__("x86_64_current_tls:\n\t" func ":" #define STUB_ASM_CODE(slot) \ - "movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" \ + "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" \ "movq %fs:(%rax), %r11\n\t" \ "jmp *(8 * " slot ")(%r11)" diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h index de0498181d..ff2b9575f6 100644 --- a/src/mapi/mapi/entry_x86_tls.h +++ b/src/mapi/mapi/entry_x86_tls.h @@ -37,7 +37,7 @@ __asm__("x86_current_tls:\n\t" "1:\n\t" "popl %eax\n\t" "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" - "movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax\n\t" + "movl u_current_table_tls@GOTNTPOFF(%eax), %eax\n\t" "ret"); #ifndef GLX_X86_READONLY_TEXT diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h index d31e0676f0..fbf4ec5497 100644 --- a/src/mapi/mapi/entry_x86_tsd.h +++ b/src/mapi/mapi/entry_x86_tsd.h @@ -41,12 +41,12 @@ __asm__(".text"); func ":" #define STUB_ASM_CODE(slot) \ - "movl _glapi_Dispatch, %eax\n\t" \ + "movl u_current_table, %eax\n\t" \ "testl %eax, %eax\n\t" \ "je 1f\n\t" \ "jmp *(4 * " slot ")(%eax)\n" \ "1:\n\t" \ - "call _glapi_get_dispatch\n\t" \ + "call u_current_get_internal\n\t"\ "jmp *(4 * " slot ")(%eax)" #define MAPI_TMP_STUB_ASM_GCC diff --git a/src/mapi/mapi/mapi.h b/src/mapi/mapi/mapi.h index 8832b3dfb6..c7e43e22e9 100644 --- a/src/mapi/mapi/mapi.h +++ b/src/mapi/mapi/mapi.h @@ -31,26 +31,36 @@ #include "u_compiler.h" +#ifdef _WIN32 +#ifdef MAPI_DLL_EXPORTS +#define MAPI_EXPORT __declspec(dllexport) +#else +#define MAPI_EXPORT __declspec(dllimport) +#endif +#else /* _WIN32 */ +#define MAPI_EXPORT PUBLIC +#endif + typedef void (*mapi_proc)(void); struct mapi_table; -PUBLIC void +MAPI_EXPORT void mapi_init(const char *spec); -PUBLIC mapi_proc +MAPI_EXPORT mapi_proc mapi_get_proc_address(const char *name); -PUBLIC struct mapi_table * +MAPI_EXPORT struct mapi_table * mapi_table_create(void); -PUBLIC void +MAPI_EXPORT void mapi_table_destroy(struct mapi_table *tbl); -PUBLIC void +MAPI_EXPORT void mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs); -PUBLIC void +MAPI_EXPORT void mapi_table_make_current(const struct mapi_table *tbl); #endif /* _MAPI_H_ */ diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c index 91547c4830..ed9ccfe229 100644 --- a/src/mapi/mapi/u_current.c +++ b/src/mapi/mapi/u_current.c @@ -99,25 +99,25 @@ extern void (*__glapi_noop_table[])(void); /*@{*/ #if defined(GLX_USE_TLS) -__thread struct _glapi_table *_glapi_tls_Dispatch +__thread struct mapi_table *u_current_table_tls __attribute__((tls_model("initial-exec"))) - = (struct _glapi_table *) table_noop_array; + = (struct mapi_table *) table_noop_array; -__thread void * _glapi_tls_Context +__thread void *u_current_user_tls __attribute__((tls_model("initial-exec"))); -const struct _glapi_table *_glapi_Dispatch; -const void *_glapi_Context; +const struct mapi_table *u_current_table; +const void *u_current_user; #else -struct _glapi_table *_glapi_Dispatch = - (struct _glapi_table *) table_noop_array; -void *_glapi_Context; +struct mapi_table *u_current_table = + (struct mapi_table *) table_noop_array; +void *u_current_user; #ifdef THREADS -struct u_tsd _gl_DispatchTSD; -static struct u_tsd ContextTSD; +struct u_tsd u_current_table_tsd; +static struct u_tsd u_current_user_tsd; static int ThreadSafe; #endif /* THREADS */ @@ -126,11 +126,11 @@ static int ThreadSafe; void -_glapi_destroy_multithread(void) +u_current_destroy(void) { #if defined(THREADS) && defined(WIN32_THREADS) - u_tsd_destroy(&_gl_DispatchTSD); - u_tsd_destroy(&ContextTSD); + u_tsd_destroy(&u_current_table_tsd); + u_tsd_destroy(&u_current_user_tsd); #endif } @@ -138,10 +138,10 @@ _glapi_destroy_multithread(void) #if defined(THREADS) && !defined(GLX_USE_TLS) static void -_glapi_init_multithread(void) +u_current_init_tsd(void) { - u_tsd_init(&_gl_DispatchTSD); - u_tsd_init(&ContextTSD); + u_tsd_init(&u_current_table_tsd); + u_tsd_init(&u_current_user_tsd); } /** @@ -162,7 +162,7 @@ u_mutex_declare_static(ThreadCheckMutex); * in order to test if multiple threads are being used. */ void -_glapi_check_multithread(void) +u_current_init(void) { static unsigned long knownID; static int firstCall = 1; @@ -172,15 +172,15 @@ _glapi_check_multithread(void) CHECK_MULTITHREAD_LOCK(); if (firstCall) { - _glapi_init_multithread(); + u_current_init_tsd(); knownID = u_thread_self(); firstCall = 0; } else if (knownID != u_thread_self()) { ThreadSafe = 1; - _glapi_set_dispatch(NULL); - _glapi_set_context(NULL); + u_current_set_internal(NULL); + u_current_set_user_internal(NULL); } CHECK_MULTITHREAD_UNLOCK(); } @@ -188,7 +188,7 @@ _glapi_check_multithread(void) #else void -_glapi_check_multithread(void) +u_current_init(void) { } @@ -202,15 +202,17 @@ _glapi_check_multithread(void) * void from the real context pointer type. */ void -_glapi_set_context(void *context) +u_current_set_user_internal(void *ptr) { + u_current_init(); + #if defined(GLX_USE_TLS) - _glapi_tls_Context = context; + u_current_user_tls = ptr; #elif defined(THREADS) - u_tsd_set(&ContextTSD, context); - _glapi_Context = (ThreadSafe) ? NULL : context; + u_tsd_set(&u_current_user_tsd, ptr); + u_current_user = (ThreadSafe) ? NULL : ptr; #else - _glapi_Context = context; + u_current_user = ptr; #endif } @@ -220,16 +222,16 @@ _glapi_set_context(void *context) * void to the real context pointer type. */ void * -_glapi_get_context(void) +u_current_get_user_internal(void) { #if defined(GLX_USE_TLS) - return _glapi_tls_Context; + return u_current_user_tls; #elif defined(THREADS) return (ThreadSafe) - ? u_tsd_get(&ContextTSD) - : _glapi_Context; + ? u_tsd_get(&u_current_user_tsd) + : u_current_user; #else - return _glapi_Context; + return u_current_user; #endif } @@ -239,36 +241,37 @@ _glapi_get_context(void) * table (__glapi_noop_table). */ void -_glapi_set_dispatch(struct _glapi_table *dispatch) +u_current_set_internal(struct mapi_table *tbl) { + u_current_init(); + stub_init_once(); - if (!dispatch) - dispatch = (struct _glapi_table *) table_noop_array; + if (!tbl) + tbl = (struct mapi_table *) table_noop_array; #if defined(GLX_USE_TLS) - _glapi_tls_Dispatch = dispatch; + u_current_table_tls = tbl; #elif defined(THREADS) - u_tsd_set(&_gl_DispatchTSD, (void *) dispatch); - _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch; + u_tsd_set(&u_current_table_tsd, (void *) tbl); + u_current_table = (ThreadSafe) ? NULL : tbl; #else - _glapi_Dispatch = dispatch; + u_current_table = tbl; #endif } /** * Return pointer to current dispatch table for calling thread. */ -struct _glapi_table * -_glapi_get_dispatch(void) +struct mapi_table * +u_current_get_internal(void) { #if defined(GLX_USE_TLS) - return _glapi_tls_Dispatch; + return u_current_table_tls; #elif defined(THREADS) - return (ThreadSafe) - ? (struct _glapi_table *) u_tsd_get(&_gl_DispatchTSD) - : _glapi_Dispatch; + return (struct mapi_table *) ((ThreadSafe) ? + u_tsd_get(&u_current_table_tsd) : (void *) u_current_table); #else - return _glapi_Dispatch; + return u_current_table; #endif } diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index a6256f5b51..62e54c6c93 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -1,93 +1,102 @@ #ifndef _U_CURRENT_H_ #define _U_CURRENT_H_ -#include "u_compiler.h" - #ifdef MAPI_GLAPI_CURRENT -#define GLAPI_EXPORT PUBLIC -#else -#define GLAPI_EXPORT -#endif -/* - * Unlike other utility functions, we need to keep the old names (_glapi_*) for - * ABI compatibility. The desired functions are wrappers to the old ones. - */ +#include "glapi/glapi.h" + +/* ugly renames to match glapi.h */ +#define mapi_table _glapi_table + +#define u_current_table_tls _glapi_tls_Dispatch +#define u_current_user_tls _glapi_tls_Context +#define u_current_table _glapi_Dispatch +#define u_current_user _glapi_Context + +#define u_current_destroy _glapi_destroy_multithread +#define u_current_init _glapi_check_multithread +#define u_current_set_internal _glapi_set_dispatch +#define u_current_get_internal _glapi_get_dispatch +#define u_current_set_user_internal _glapi_set_context +#define u_current_get_user_internal _glapi_get_context + +#define u_current_table_tsd _gl_DispatchTSD + +#else /* MAPI_GLAPI_CURRENT */ + +#include "u_compiler.h" -struct _glapi_table; +struct mapi_table; #ifdef GLX_USE_TLS -GLAPI_EXPORT extern __thread struct _glapi_table *_glapi_tls_Dispatch +extern __thread struct mapi_table *u_current_table_tls __attribute__((tls_model("initial-exec"))); -GLAPI_EXPORT extern __thread void *_glapi_tls_Context +extern __thread void *u_current_user_tls __attribute__((tls_model("initial-exec"))); -GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; -GLAPI_EXPORT extern const void *_glapi_Context; +extern const struct mapi_table *u_current_table; +extern const void *u_current_user; #else /* GLX_USE_TLS */ -GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch; -GLAPI_EXPORT extern void *_glapi_Context; +extern struct mapi_table *u_current_table; +extern void *u_current_user; #endif /* GLX_USE_TLS */ -GLAPI_EXPORT void -_glapi_check_multithread(void); - -GLAPI_EXPORT void -_glapi_set_context(void *context); +void +u_current_init(void); -GLAPI_EXPORT void * -_glapi_get_context(void); +void +u_current_destroy(void); -GLAPI_EXPORT void -_glapi_set_dispatch(struct _glapi_table *dispatch); +void +u_current_set_internal(struct mapi_table *tbl); -GLAPI_EXPORT struct _glapi_table * -_glapi_get_dispatch(void); +struct mapi_table * +u_current_get_internal(void); void -_glapi_destroy_multithread(void); - +u_current_set_user_internal(void *ptr); -struct mapi_table; +void * +u_current_get_user_internal(void); static INLINE void u_current_set(const struct mapi_table *tbl) { - _glapi_check_multithread(); - _glapi_set_dispatch((struct _glapi_table *) tbl); + u_current_set_internal((struct mapi_table *) tbl); } static INLINE const struct mapi_table * u_current_get(void) { #ifdef GLX_USE_TLS - return (const struct mapi_table *) _glapi_tls_Dispatch; + return (const struct mapi_table *) u_current_table_tls; #else - return (const struct mapi_table *) (likely(_glapi_Dispatch) ? - _glapi_Dispatch : _glapi_get_dispatch()); + return (likely(u_current_table) ? + (const struct mapi_table *) u_current_table : u_current_get_internal()); #endif } static INLINE void u_current_set_user(void *ptr) { - _glapi_check_multithread(); - _glapi_set_context(ptr); + u_current_set_internal(ptr); } static INLINE void * u_current_get_user(void) { #ifdef GLX_USE_TLS - return _glapi_tls_Context; + return u_current_user_tls; #else - return likely(_glapi_Context) ? _glapi_Context : _glapi_get_context(); + return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); #endif } -#endif /* GLX_USE_TLS */ +#endif /* MAPI_GLAPI_CURRENT */ + +#endif /* _U_CURRENT_H_ */ diff --git a/src/mapi/vgapi/SConscript b/src/mapi/vgapi/SConscript index bf51264ab9..20d7f2744d 100644 --- a/src/mapi/vgapi/SConscript +++ b/src/mapi/vgapi/SConscript @@ -18,6 +18,7 @@ if env['platform'] != 'winddk': env.Append(CPPDEFINES = [ 'MAPI_ABI_HEADER=\\"vgapi/vgapi_tmp.h\\"', + 'MAPI_DLL_EXPORTS', 'KHRONOS_DLL_EXPORTS', ]) |