From 847a6d50dbd3947951d3b12dc3c6b4d6a43000a5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Mar 2014 18:27:10 -0700 Subject: [PATCH] Avoid using eglGPA() for core funcs when the current context is GLX. If you already had GLX loaded by epoxy, this wouldn't happen, but on the first call, fallback cases might have taken the EGL path if EGL was loaded. --- src/dispatch_common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dispatch_common.c b/src/dispatch_common.c index 79aa9fc..788aace 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -517,6 +517,11 @@ epoxy_get_proc_address(const char *name) #else if (api.glx_handle && glXGetCurrentContext()) { return glXGetProcAddressARB((const GLubyte *)name); +#if PLATFORM_HAS_EGL + } else if (api.egl_handle && + epoxy_egl_get_current_gl_context_api() != EGL_NONE) { + return eglGetProcAddress(name); +#endif /* PLATFORM_HAS_EGL */ } else { /* If the application hasn't explicitly called some of our GLX * or EGL code but has presumably set up a context on its own, @@ -536,7 +541,7 @@ epoxy_get_proc_address(const char *name) #if PLATFORM_HAS_EGL egl_gpa = dlsym(NULL, "eglGetProcAddress"); - if (egl_gpa) + if (egl_gpa && epoxy_egl_get_current_gl_context_api() != EGL_NONE) return egl_gpa(name); #endif /* PLATFORM_HAS_EGL */ @@ -552,7 +557,7 @@ epoxy_get_proc_address(const char *name) #if PLATFORM_HAS_EGL egl_gpa = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetProcAddress", false); - if (egl_gpa) + if (egl_gpa && epoxy_egl_get_current_gl_context_api() != EGL_NONE) return egl_gpa(name); #endif /* PLATFORM_HAS_EGL */