summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2018-04-30 15:26:17 -0400
committerAdam Jackson <ajax@redhat.com>2018-04-30 15:33:42 -0400
commitb5a4b16799a30cb74db1916d52f2756a7a5345ed (patch)
tree28a83b6fd3a700c9a161914f37e1c5d934e769b1 /src
parent43ac91170d61514ab1dd156a4373664b961d81d3 (diff)
downloadlibepoxy-b5a4b16799a30cb74db1916d52f2756a7a5345ed.tar.gz
dispatch: Query the EGL context version when bootstrapping on GLES
We're about to change our dlopen paths to do RTLD_NOLOAD more aggressively. The issue then is we can create an EGL GLES context without libGLES* ever being loaded. test/egl_gles2_without_glx will fail in such a world: the first gentle probe for libGLESv2 will fail, then the less-gentle probe for libGLESv1_CM will be shot down by the test, and we exit. Fortunately by the time we've gotten to this point the context exists, so we can query its version via EGL instead. Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/dispatch_common.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index 1eccb3b..bf10d52 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -812,20 +812,20 @@ epoxy_get_bootstrap_proc_address(const char *name)
#if PLATFORM_HAS_EGL
get_dlopen_handle(&api.egl_handle, EGL_LIB, false);
if (api.egl_handle) {
+ int version = 0;
switch (epoxy_egl_get_current_gl_context_api()) {
case EGL_OPENGL_API:
return epoxy_gl_dlsym(name);
case EGL_OPENGL_ES_API:
- /* We can't resolve the GL version, because
- * epoxy_glGetString() is one of the two things calling
- * us. Try the GLES2 implementation first, and fall back
- * to GLES1 otherwise.
- */
- get_dlopen_handle(&api.gles2_handle, GLES2_LIB, false);
- if (api.gles2_handle)
- return epoxy_gles2_dlsym(name);
- else
- return epoxy_gles1_dlsym(name);
+ if (eglQueryContext(eglGetCurrentDisplay(),
+ eglGetCurrentContext(),
+ EGL_CONTEXT_CLIENT_VERSION,
+ &version)) {
+ if (version >= 2)
+ return epoxy_gles2_dlsym(name);
+ else
+ return epoxy_gles1_dlsym(name);
+ }
}
}
#endif /* PLATFORM_HAS_EGL */