4 #if defined(MAPI_MODE_UTIL) || defined(MAPI_MODE_GLAPI) || \
5 defined(MAPI_MODE_BRIDGE)
7 #include "glapi/glapi.h"
9 /* ugly renames to match glapi.h */
10 #define mapi_table _glapi_table
13 #define u_current_table _glapi_tls_Dispatch
14 #define u_current_user _glapi_tls_Context
16 #define u_current_table _glapi_Dispatch
17 #define u_current_user _glapi_Context
20 #define u_current_get_internal _glapi_get_dispatch
21 #define u_current_get_user_internal _glapi_get_context
23 #define u_current_table_tsd _gl_DispatchTSD
25 #else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
27 #include "u_compiler.h"
33 extern __thread
struct mapi_table
*u_current_table
34 __attribute__((tls_model("initial-exec")));
36 extern __thread
void *u_current_user
37 __attribute__((tls_model("initial-exec")));
39 #else /* GLX_USE_TLS */
41 extern struct mapi_table
*u_current_table
;
42 extern void *u_current_user
;
44 #endif /* GLX_USE_TLS */
46 #endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
52 u_current_destroy(void);
55 u_current_set(const struct mapi_table
*tbl
);
58 u_current_get_internal(void);
61 u_current_set_user(const void *ptr
);
64 u_current_get_user_internal(void);
66 static INLINE
const struct mapi_table
*
70 return u_current_table
;
72 return (likely(u_current_table
) ?
73 u_current_table
: u_current_get_internal());
77 static INLINE
const void *
78 u_current_get_user(void)
81 return u_current_user
;
83 return likely(u_current_user
) ? u_current_user
: u_current_get_user_internal();
87 #endif /* _U_CURRENT_H_ */