u_current.h revision 1463c08d
1af69d88dSmrg#ifndef _U_CURRENT_H_
2af69d88dSmrg#define _U_CURRENT_H_
3af69d88dSmrg
401e04c3fSmrg#include "c99_compat.h"
501e04c3fSmrg#include "util/macros.h"
601e04c3fSmrg
701e04c3fSmrg
8af69d88dSmrg#if defined(MAPI_MODE_UTIL) || defined(MAPI_MODE_GLAPI) || \
9af69d88dSmrg    defined(MAPI_MODE_BRIDGE)
10af69d88dSmrg
11af69d88dSmrg#include "glapi/glapi.h"
12af69d88dSmrg
131463c08dSmrg#ifdef USE_ELF_TLS
14af69d88dSmrg#define u_current_table _glapi_tls_Dispatch
15af69d88dSmrg#define u_current_context _glapi_tls_Context
16af69d88dSmrg#else
17af69d88dSmrg#define u_current_table _glapi_Dispatch
18af69d88dSmrg#define u_current_context _glapi_Context
19af69d88dSmrg#endif
20af69d88dSmrg
21af69d88dSmrg#define u_current_get_table_internal _glapi_get_dispatch
22af69d88dSmrg#define u_current_get_context_internal _glapi_get_context
23af69d88dSmrg
24af69d88dSmrg#define u_current_table_tsd _gl_DispatchTSD
25af69d88dSmrg
26af69d88dSmrg#else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
27af69d88dSmrg
2801e04c3fSmrgstruct _glapi_table;
29af69d88dSmrg
301463c08dSmrg#ifdef USE_ELF_TLS
31af69d88dSmrg
321463c08dSmrgextern __THREAD_INITIAL_EXEC struct _glapi_table *u_current_table;
331463c08dSmrgextern __THREAD_INITIAL_EXEC void *u_current_context;
34af69d88dSmrg
351463c08dSmrg#else /* USE_ELF_TLS */
36af69d88dSmrg
3701e04c3fSmrgextern struct _glapi_table *u_current_table;
38af69d88dSmrgextern void *u_current_context;
39af69d88dSmrg
401463c08dSmrg#endif /* USE_ELF_TLS */
41af69d88dSmrg
42af69d88dSmrg#endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
43af69d88dSmrg
44af69d88dSmrgvoid
45af69d88dSmrgu_current_init(void);
46af69d88dSmrg
47af69d88dSmrgvoid
48af69d88dSmrgu_current_destroy(void);
49af69d88dSmrg
50af69d88dSmrgvoid
5101e04c3fSmrgu_current_set_table(const struct _glapi_table *tbl);
52af69d88dSmrg
531463c08dSmrg_GLAPI_EXPORT struct _glapi_table *
54af69d88dSmrgu_current_get_table_internal(void);
55af69d88dSmrg
56af69d88dSmrgvoid
57af69d88dSmrgu_current_set_context(const void *ptr);
58af69d88dSmrg
591463c08dSmrg_GLAPI_EXPORT void *
60af69d88dSmrgu_current_get_context_internal(void);
61af69d88dSmrg
62af69d88dSmrg#endif /* _U_CURRENT_H_ */
63