diff options
author | Kyle Brenneman <[email protected]> | 2016-07-08 15:21:17 -0600 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2016-09-07 11:56:48 -0400 |
commit | 6e066f76ee22909b0653ff8b89429de819e60f14 (patch) | |
tree | 07b82d16ed9c2a74263f8ca92a8dad65875cbc14 /src/egl/main/eglcurrent.h | |
parent | 74b1969d717f2428f0b9dcaaea611e95736120a5 (diff) |
EGL: Combine the GL and GLES current contexts (v2)
Only keep track of a single current context, instead of separate
contexts for GL and GLES.
In EGL 1.4 (and 1.5), EGL_OPENGL_API and EGL_OPENGL_ES_API are supposed
to be interchangeable for all purposes except for eglCreateContext.
The _EGLThreadInfo::CurrentContexts array is now a single pointer to the
current context, which may be a GL or GLES context. In addition, it now
keeps track of the current API as an enum instead of an index.
eglMakeCurrent will now replace the current context, regardless of which
client API is used for for the current and new contexts. It no longer
checks for a conflicting context. In addition, calling eglMakeCurrent
with EGL_NO_CONTEXT will now release the current context regardless of
the current API.
v2: Rebased against master (Adam Jackson)
Reviewed-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/egl/main/eglcurrent.h')
-rw-r--r-- | src/egl/main/eglcurrent.h | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h index 3f8a0b28e38..b922435e31f 100644 --- a/src/egl/main/eglcurrent.h +++ b/src/egl/main/eglcurrent.h @@ -46,20 +46,14 @@ extern "C" { EGL_OPENGL_BIT) -#define _EGL_API_FIRST_API EGL_OPENGL_ES_API -#define _EGL_API_LAST_API EGL_OPENGL_API -#define _EGL_API_NUM_APIS (_EGL_API_LAST_API - _EGL_API_FIRST_API + 1) - - /** * Per-thread info */ struct _egl_thread_info { EGLint LastError; - _EGLContext *CurrentContexts[_EGL_API_NUM_APIS]; - /* use index for fast access to current context */ - EGLint CurrentAPIIndex; + _EGLContext *CurrentContext; + EGLenum CurrentAPI; }; @@ -71,36 +65,13 @@ _eglIsApiValid(EGLenum api) { #ifdef ANDROID /* OpenGL is not a valid/supported API on Android */ - return api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API && - api != EGL_OPENGL_API; + return api == EGL_OPENGL_ES_API; #else - return api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API; + return (api == EGL_OPENGL_ES_API || api == EGL_OPENGL_API); #endif } -/** - * Convert a client API enum to an index, for use by thread info. - * The client API enum is assumed to be valid. - */ -static inline EGLint -_eglConvertApiToIndex(EGLenum api) -{ - return api - _EGL_API_FIRST_API; -} - - -/** - * Convert an index, used by thread info, to a client API enum. - * The index is assumed to be valid. - */ -static inline EGLenum -_eglConvertApiFromIndex(EGLint idx) -{ - return _EGL_API_FIRST_API + idx; -} - - extern _EGLThreadInfo * _eglGetCurrentThread(void); @@ -114,10 +85,6 @@ _eglIsCurrentThreadDummy(void); extern _EGLContext * -_eglGetAPIContext(EGLenum api); - - -extern _EGLContext * _eglGetCurrentContext(void); |