diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-08-21 12:10:02 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-08-21 14:13:59 +0800 |
commit | df98423f24bca147b36076e39fe53f42028052ef (patch) | |
tree | 71ba561949eae4b13070a39b426a731410b34945 /src/mapi/mapi/u_current.h | |
parent | 760451baaec42bced6ade5026546ed3759495d70 (diff) |
mapi: Prefix functions in u_current.h by u_current.
That is, replace the old _glapi_* names by new names that start with
u_current_. When MAPI_GLAPI_CURRENT is defined, u_current.h defines
rename macros to restore the old names. That is done for ABI
compatibility.
Diffstat (limited to 'src/mapi/mapi/u_current.h')
-rw-r--r-- | src/mapi/mapi/u_current.h | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index a6bd9f0838..62e54c6c93 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -1,87 +1,99 @@ #ifndef _U_CURRENT_H_ #define _U_CURRENT_H_ -#include "u_compiler.h" - #ifdef MAPI_GLAPI_CURRENT #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 */ -struct _glapi_table; +#include "u_compiler.h" + +struct mapi_table; #ifdef GLX_USE_TLS -extern __thread struct _glapi_table *_glapi_tls_Dispatch +extern __thread struct mapi_table *u_current_table_tls __attribute__((tls_model("initial-exec"))); -extern __thread void *_glapi_tls_Context +extern __thread void *u_current_user_tls __attribute__((tls_model("initial-exec"))); -extern const struct _glapi_table *_glapi_Dispatch; -extern const void *_glapi_Context; +extern const struct mapi_table *u_current_table; +extern const void *u_current_user; #else /* GLX_USE_TLS */ -extern struct _glapi_table *_glapi_Dispatch; -extern void *_glapi_Context; +extern struct mapi_table *u_current_table; +extern void *u_current_user; #endif /* GLX_USE_TLS */ void -_glapi_check_multithread(void); +u_current_init(void); void -_glapi_set_context(void *context); - -void * -_glapi_get_context(void); +u_current_destroy(void); void -_glapi_set_dispatch(struct _glapi_table *dispatch); +u_current_set_internal(struct mapi_table *tbl); -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 } |