eglcurrent.h revision 4a49301e
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 */
22struct _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 */
34static 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 */
45static 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 */
56static INLINE EGLenum
57_eglConvertApiFromIndex(EGLint idx)
58{
59   return _EGL_API_FIRST_API + idx;
60}
61
62
63extern _EGLThreadInfo *
64_eglGetCurrentThread(void);
65
66
67extern void
68_eglDestroyCurrentThread(void);
69
70
71extern EGLBoolean
72_eglIsCurrentThreadDummy(void);
73
74
75extern _EGLContext *
76_eglGetCurrentContext(void);
77
78
79extern _EGLDisplay *
80_eglGetCurrentDisplay(void);
81
82
83extern _EGLSurface *
84_eglGetCurrentSurface(EGLint readdraw);
85
86
87extern EGLBoolean
88_eglError(EGLint errCode, const char *msg);
89
90
91#endif /* EGLCURRENT_INCLUDED */
92