diff options
| author | Yaron Cohen-Tal <yaronct@gmail.com> | 2015-09-21 19:58:03 +0300 |
|---|---|---|
| committer | Yaron Cohen-Tal <yaronct@gmail.com> | 2015-10-31 20:17:47 +0200 |
| commit | 8d58c890646fc1f43bcab702bb9ed6bae94daefe (patch) | |
| tree | f121fb1c057d9fb3dd0edd3779f0e762408e74de /src | |
| parent | b3b8bd9af7bf1fcfe544fd131f4d4f0d117ae7bc (diff) | |
| download | libepoxy-8d58c890646fc1f43bcab702bb9ed6bae94daefe.tar.gz | |
Fix "epoxy_egl_get_current_gl_context_api" to use "eglQueryContext" with "EGL_CONTEXT_CLIENT_TYPE" as "attribute".
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispatch_common.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c index 1667119..f3570bd 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -542,31 +542,13 @@ epoxy_get_core_proc_address(const char *name, int core_version) static EGLenum epoxy_egl_get_current_gl_context_api(void) { - EGLenum save_api = eglQueryAPI(); - EGLContext ctx; - - if (eglBindAPI(EGL_OPENGL_API)) { - ctx = eglGetCurrentContext(); - if (ctx) { - eglBindAPI(save_api); - return EGL_OPENGL_API; - } - } else { - (void)eglGetError(); - } - - if (eglBindAPI(EGL_OPENGL_ES_API)) { - ctx = eglGetCurrentContext(); - eglBindAPI(save_api); - if (ctx) { - eglBindAPI(save_api); - return EGL_OPENGL_ES_API; - } - } else { - (void)eglGetError(); - } - - return EGL_NONE; + EGLDisplay eglDisplay = eglGetCurrentDisplay(); + EGLContext eglContext = eglGetCurrentContext(); + EGLint eglContextClientType = EGL_NONE; + return eglQueryContext(eglDisplay, eglContext, EGL_CONTEXT_CLIENT_TYPE, + &eglContextClientType) == EGL_TRUE + ? (EGLenum)eglContextClientType + : EGL_NONE; } #endif /* EPOXY_SUPPORT_EGL */ |
