Try to use glXGPA() for core funcs if the current context is GLX.

Fixes the GLX-only subtest of egl_and_glx_different_pointers.  Now
what remains is dispatch tables for when you're actively using both.

Fixes #23
macos/v1.5.9
Eric Anholt 11 years ago
parent 698185e24a
commit e6d9bb971b
  1. 30
      src/dispatch_common.c
  2. 1
      test/Makefile.am

@ -499,13 +499,7 @@ epoxy_get_proc_address(const char *name)
#elif defined(__APPLE__) #elif defined(__APPLE__)
return epoxy_gl_dlsym(name); return epoxy_gl_dlsym(name);
#else #else
if (api.egl_handle) { if (api.glx_handle && glXGetCurrentContext()) {
#if PLATFORM_HAS_EGL
return eglGetProcAddress(name);
#else
return NULL;
#endif
} else if (api.glx_handle) {
return glXGetProcAddressARB((const GLubyte *)name); return glXGetProcAddressARB((const GLubyte *)name);
} else { } else {
/* If the application hasn't explicitly called some of our GLX /* If the application hasn't explicitly called some of our GLX
@ -516,34 +510,36 @@ epoxy_get_proc_address(const char *name)
* application's namespace, then use that. * application's namespace, then use that.
*/ */
PFNGLXGETPROCADDRESSARBPROC glx_gpa; PFNGLXGETPROCADDRESSARBPROC glx_gpa;
#if PLATFORM_HAS_EGL #if PLATFORM_HAS_EGL
PFNEGLGETPROCADDRESSPROC egl_gpa; PFNEGLGETPROCADDRESSPROC egl_gpa;
egl_gpa = dlsym(NULL, "eglGetProcAddress");
if (egl_gpa)
return egl_gpa(name);
#endif #endif
glx_gpa = dlsym(NULL, "glXGetProcAddressARB"); glx_gpa = dlsym(NULL, "glXGetProcAddressARB");
if (glx_gpa) if (glx_gpa && glXGetCurrentContext())
return glx_gpa((const GLubyte *)name); return glx_gpa((const GLubyte *)name);
#if PLATFORM_HAS_EGL #if PLATFORM_HAS_EGL
egl_gpa = dlsym(NULL, "eglGetProcAddress");
if (egl_gpa)
return egl_gpa(name);
#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",
false);
if (glx_gpa && glXGetCurrentContext())
return glx_gpa((const GLubyte *)name);
#if PLATFORM_HAS_EGL
egl_gpa = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetProcAddress", egl_gpa = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetProcAddress",
false); false);
if (egl_gpa) if (egl_gpa)
return egl_gpa(name); return egl_gpa(name);
#endif /* PLATFORM_HAS_EGL */ #endif /* PLATFORM_HAS_EGL */
return do_dlsym(&api.glx_handle, GLX_LIB, "glXGetProcAddressARB",
false);
if (glx_gpa)
return glx_gpa((const GLubyte *)name);
errx(1, "Couldn't find GLX or EGL libraries.\n"); errx(1, "Couldn't find GLX or EGL libraries.\n");
} }
#endif #endif

@ -64,7 +64,6 @@ check_BINARIES = $(EGL_AND_GLX_BIN)
XFAIL_TESTS = \ XFAIL_TESTS = \
egl_and_glx_different_pointers_egl_glx \ egl_and_glx_different_pointers_egl_glx \
egl_and_glx_different_pointers_glx \
$() $()
check_PROGRAMS = $(TESTS) check_PROGRAMS = $(TESTS)

Loading…
Cancel
Save