summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-03-19 18:27:10 -0700
committerEric Anholt <eric@anholt.net>2014-03-19 18:43:21 -0700
commit847a6d50dbd3947951d3b12dc3c6b4d6a43000a5 (patch)
tree97ab760c058a119f45503a3924b7ccec8544ed8c
parentb670c840390859d20c478b9494e09b0c99aaab51 (diff)
downloadlibepoxy-847a6d50dbd3947951d3b12dc3c6b4d6a43000a5.tar.gz
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.
-rw-r--r--src/dispatch_common.c9
1 files 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 */