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>
macos/v1.5.9
Adam Jackson 7 years ago
parent 43ac91170d
commit b5a4b16799
  1. 14
      src/dispatch_common.c

@ -812,22 +812,22 @@ epoxy_get_bootstrap_proc_address(const char *name)
#if PLATFORM_HAS_EGL #if PLATFORM_HAS_EGL
get_dlopen_handle(&api.egl_handle, EGL_LIB, false); get_dlopen_handle(&api.egl_handle, EGL_LIB, false);
if (api.egl_handle) { if (api.egl_handle) {
int version = 0;
switch (epoxy_egl_get_current_gl_context_api()) { switch (epoxy_egl_get_current_gl_context_api()) {
case EGL_OPENGL_API: case EGL_OPENGL_API:
return epoxy_gl_dlsym(name); return epoxy_gl_dlsym(name);
case EGL_OPENGL_ES_API: case EGL_OPENGL_ES_API:
/* We can't resolve the GL version, because if (eglQueryContext(eglGetCurrentDisplay(),
* epoxy_glGetString() is one of the two things calling eglGetCurrentContext(),
* us. Try the GLES2 implementation first, and fall back EGL_CONTEXT_CLIENT_VERSION,
* to GLES1 otherwise. &version)) {
*/ if (version >= 2)
get_dlopen_handle(&api.gles2_handle, GLES2_LIB, false);
if (api.gles2_handle)
return epoxy_gles2_dlsym(name); return epoxy_gles2_dlsym(name);
else else
return epoxy_gles1_dlsym(name); return epoxy_gles1_dlsym(name);
} }
} }
}
#endif /* PLATFORM_HAS_EGL */ #endif /* PLATFORM_HAS_EGL */
/* Fall back to GLX */ /* Fall back to GLX */

Loading…
Cancel
Save