summaryrefslogtreecommitdiff
path: root/src/dispatch_common.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-01-18 15:36:54 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2017-01-25 12:22:57 +0000
commitbac9400bb04ce56c7a71a490e175284106743698 (patch)
treee31905a8a3495c53238bf754ea555e10f008deab /src/dispatch_common.c
parent9e46b8e659bfb61a713f099a339c1c1e8b552a8f (diff)
downloadlibepoxy-bac9400bb04ce56c7a71a490e175284106743698.tar.gz
Use EGL to retrieve pointers if available
EGL is available on different platforms, so we should favor it, if available. This also allows us to decouple EGL from GLX, and use the former without the latter being compiled in.
Diffstat (limited to 'src/dispatch_common.c')
-rw-r--r--src/dispatch_common.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index 74ad645..30e69ca 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -642,28 +642,32 @@ epoxy_get_bootstrap_proc_address(const char *name)
void *
epoxy_get_proc_address(const char *name)
{
-#ifdef _WIN32
+#if PLATFORM_HAS_EGL
+ GLenum egl_api = EGL_NONE;
+
+ if (!epoxy_current_context_is_glx())
+ egl_api = epoxy_egl_get_current_gl_context_api();
+
+ switch (egl_api) {
+ case EGL_OPENGL_API:
+ case EGL_OPENGL_ES_API:
+ return eglGetProcAddress(name);
+ case EGL_NONE:
+ break;
+ }
+#endif
+
+#if defined(_WIN32)
return wglGetProcAddress(name);
#elif defined(__APPLE__)
return epoxy_gl_dlsym(name);
-#else
- if (epoxy_current_context_is_glx()) {
+#elif PLATFORM_HAS_GLX
+ if (epoxy_current_context_is_glx())
return glXGetProcAddressARB((const GLubyte *)name);
- } else {
-#if PLATFORM_HAS_EGL
- GLenum egl_api = epoxy_egl_get_current_gl_context_api();
-
- switch (egl_api) {
- case EGL_OPENGL_API:
- case EGL_OPENGL_ES_API:
- return eglGetProcAddress(name);
- case EGL_NONE:
- break;
- }
#endif
- }
errx(1, "Couldn't find current GLX or EGL context.\n");
-#endif
+
+ return NULL;
}
WRAPPER_VISIBILITY (void)