373d48fb939a79425a99c257a78570eb5b24d169
4 #ifdef MAPI_GLAPI_CURRENT
6 #include "glapi/glapi.h"
8 /* ugly renames to match glapi.h */
9 #define mapi_table _glapi_table
12 #define u_current_table _glapi_tls_Dispatch
13 #define u_current_user _glapi_tls_Context
15 #define u_current_table _glapi_Dispatch
16 #define u_current_user _glapi_Context
19 #define u_current_get_internal _glapi_get_dispatch
20 #define u_current_get_user_internal _glapi_get_context
22 #define u_current_table_tsd _gl_DispatchTSD
24 #else /* MAPI_GLAPI_CURRENT */
26 #include "u_compiler.h"
32 extern __thread
struct mapi_table
*u_current_table
33 __attribute__((tls_model("initial-exec")));
35 extern __thread
void *u_current_user
36 __attribute__((tls_model("initial-exec")));
38 #else /* GLX_USE_TLS */
40 extern struct mapi_table
*u_current_table
;
41 extern void *u_current_user
;
43 #endif /* GLX_USE_TLS */
45 #endif /* MAPI_GLAPI_CURRENT */
51 u_current_destroy(void);
54 u_current_set(const struct mapi_table
*tbl
);
57 u_current_get_internal(void);
60 u_current_set_user(const void *ptr
);
63 u_current_get_user_internal(void);
65 static INLINE
const struct mapi_table
*
69 return u_current_table
;
71 return (likely(u_current_table
) ?
72 u_current_table
: u_current_get_internal());
76 static INLINE
const void *
77 u_current_get_user(void)
80 return u_current_user
;
82 return likely(u_current_user
) ? u_current_user
: u_current_get_user_internal();
86 #endif /* _U_CURRENT_H_ */