eglcurrent.h revision cdc920a0
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 */ 23struct _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 */ 35static 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 */ 46static 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 */ 57static INLINE EGLenum 58_eglConvertApiFromIndex(EGLint idx) 59{ 60 return _EGL_API_FIRST_API + idx; 61} 62 63 64PUBLIC _EGLThreadInfo * 65_eglGetCurrentThread(void); 66 67 68extern void 69_eglDestroyCurrentThread(void); 70 71 72extern EGLBoolean 73_eglIsCurrentThreadDummy(void); 74 75 76PUBLIC _EGLContext * 77_eglGetAPIContext(EGLenum api); 78 79 80PUBLIC _EGLContext * 81_eglGetCurrentContext(void); 82 83 84PUBLIC EGLBoolean 85_eglError(EGLint errCode, const char *msg); 86 87 88#endif /* EGLCURRENT_INCLUDED */ 89