Clean up epoxy_current_context_is_glx().

Now that it's split out from epoxy_get_core_proc_address(),
the particular symbols we were testing for before calling
GetCurrentContext() didn't make much sense, plus we were leaking
dlerror()s still.
macos/v1.5.9
Eric Anholt 11 years ago
parent db5b939f98
commit b1d875ef0b
  1. 32
      src/dispatch_common.c

@ -351,34 +351,38 @@ epoxy_current_context_is_glx(void)
* If there's a public GetProcAddress loaded in the * If there's a public GetProcAddress loaded in the
* application's namespace, then use that. * application's namespace, then use that.
*/ */
PFNGLXGETPROCADDRESSARBPROC glx_gpa; void *sym;
#if PLATFORM_HAS_EGL
PFNEGLGETPROCADDRESSPROC egl_gpa;
#endif
glx_gpa = dlsym(NULL, "glXGetProcAddressARB"); sym = dlsym(NULL, "glXGetCurrentContext");
if (glx_gpa && glXGetCurrentContext()) if (sym) {
if (glXGetCurrentContext())
return true; return true;
} else {
(void)dlerror();
}
#if PLATFORM_HAS_EGL #if PLATFORM_HAS_EGL
egl_gpa = dlsym(NULL, "eglGetProcAddress"); sym = dlsym(NULL, "eglGetCurrentContext");
if (egl_gpa && epoxy_egl_get_current_gl_context_api() != EGL_NONE) if (sym) {
return false; if (epoxy_egl_get_current_gl_context_api() != EGL_NONE)
return true;
} else {
(void)dlerror();
}
#endif /* PLATFORM_HAS_EGL */ #endif /* PLATFORM_HAS_EGL */
/* OK, couldn't find anything in the app's address space. /* OK, couldn't find anything in the app's address space.
* Presumably they dlopened with RTLD_LOCAL, which hides it * Presumably they dlopened with RTLD_LOCAL, which hides it
* from us. Just go dlopen()ing likely libraries and try them. * from us. Just go dlopen()ing likely libraries and try them.
*/ */
glx_gpa = do_dlsym(&api.glx_handle, GLX_LIB, "glXGetProcAddressARB", sym = do_dlsym(&api.glx_handle, GLX_LIB, "glXGetCurrentContext", false);
false); if (sym && glXGetCurrentContext())
if (glx_gpa && glXGetCurrentContext())
return true; return true;
#if PLATFORM_HAS_EGL #if PLATFORM_HAS_EGL
egl_gpa = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetProcAddress", sym = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetCurrentContext",
false); false);
if (egl_gpa && epoxy_egl_get_current_gl_context_api() != EGL_NONE) if (sym && epoxy_egl_get_current_gl_context_api() != EGL_NONE)
return false; return false;
#endif /* PLATFORM_HAS_EGL */ #endif /* PLATFORM_HAS_EGL */

Loading…
Cancel
Save