Merge branch 'mesa_7_7_branch'
[mesa.git] / src / egl / main / eglcurrent.h
1 #ifndef EGLCURRENT_INCLUDED
2 #define EGLCURRENT_INCLUDED
3
4 #include "egltypedefs.h"
5
6
7 #define _EGL_API_ALL_BITS \
8 (EGL_OPENGL_ES_BIT | \
9 EGL_OPENVG_BIT | \
10 EGL_OPENGL_ES2_BIT | \
11 EGL_OPENGL_BIT)
12
13
14 #define _EGL_API_FIRST_API EGL_OPENGL_ES_API
15 #define _EGL_API_LAST_API EGL_OPENGL_API
16 #define _EGL_API_NUM_APIS (_EGL_API_LAST_API - _EGL_API_FIRST_API + 1)
17
18
19 /**
20 * Per-thread info
21 */
22 struct _egl_thread_info
23 {
24 EGLint LastError;
25 _EGLContext *CurrentContexts[_EGL_API_NUM_APIS];
26 /* use index for fast access to current context */
27 EGLint CurrentAPIIndex;
28 };
29
30
31 /**
32 * Return true if a client API enum is recognized.
33 */
34 static INLINE EGLBoolean
35 _eglIsApiValid(EGLenum api)
36 {
37 return (api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API);
38 }
39
40
41 /**
42 * Convert a client API enum to an index, for use by thread info.
43 * The client API enum is assumed to be valid.
44 */
45 static INLINE EGLint
46 _eglConvertApiToIndex(EGLenum api)
47 {
48 return api - _EGL_API_FIRST_API;
49 }
50
51
52 /**
53 * Convert an index, used by thread info, to a client API enum.
54 * The index is assumed to be valid.
55 */
56 static INLINE EGLenum
57 _eglConvertApiFromIndex(EGLint idx)
58 {
59 return _EGL_API_FIRST_API + idx;
60 }
61
62
63 PUBLIC _EGLThreadInfo *
64 _eglGetCurrentThread(void);
65
66
67 extern void
68 _eglDestroyCurrentThread(void);
69
70
71 extern EGLBoolean
72 _eglIsCurrentThreadDummy(void);
73
74
75 PUBLIC _EGLContext *
76 _eglGetAPIContext(EGLenum api);
77
78
79 PUBLIC _EGLContext *
80 _eglGetCurrentContext(void);
81
82
83 PUBLIC EGLBoolean
84 _eglError(EGLint errCode, const char *msg);
85
86
87 #endif /* EGLCURRENT_INCLUDED */