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