4 #include "u_compiler.h"
6 #ifdef MAPI_GLAPI_CURRENT
7 #define GLAPI_EXPORT PUBLIC
13 * Unlike other utility functions, we need to keep the old names (_glapi_*) for
14 * ABI compatibility. The desired functions are wrappers to the old ones.
21 GLAPI_EXPORT
extern __thread
struct _glapi_table
*_glapi_tls_Dispatch
22 __attribute__((tls_model("initial-exec")));
24 GLAPI_EXPORT
extern __thread
void *_glapi_tls_Context
25 __attribute__((tls_model("initial-exec")));
27 GLAPI_EXPORT
extern const struct _glapi_table
*_glapi_Dispatch
;
28 GLAPI_EXPORT
extern const void *_glapi_Context
;
30 #else /* GLX_USE_TLS */
32 GLAPI_EXPORT
extern struct _glapi_table
*_glapi_Dispatch
;
33 GLAPI_EXPORT
extern void *_glapi_Context
;
35 #endif /* GLX_USE_TLS */
38 _glapi_check_multithread(void);
41 _glapi_set_context(void *context
);
44 _glapi_get_context(void);
47 _glapi_set_dispatch(struct _glapi_table
*dispatch
);
49 GLAPI_EXPORT
struct _glapi_table
*
50 _glapi_get_dispatch(void);
53 _glapi_destroy_multithread(void);
59 u_current_set(const struct mapi_table
*tbl
)
61 _glapi_check_multithread();
62 _glapi_set_dispatch((struct _glapi_table
*) tbl
);
65 static INLINE
const struct mapi_table
*
69 return (const struct mapi_table
*) _glapi_tls_Dispatch
;
71 return (const struct mapi_table
*) (likely(_glapi_Dispatch
) ?
72 _glapi_Dispatch
: _glapi_get_dispatch());
77 u_current_set_user(void *ptr
)
79 _glapi_check_multithread();
80 _glapi_set_context(ptr
);
84 u_current_get_user(void)
87 return _glapi_tls_Context
;
89 return likely(_glapi_Context
) ? _glapi_Context
: _glapi_get_context();
93 #endif /* GLX_USE_TLS */