dispatch: Be more paranoid about detecting GLX or not

This code attempts not to dlopen anything if it can find the appropriate
winsys symbols in the global namespace. That's nice. However we normally
do dlopen(RTLD_LOCAL) when we open lib{GLX,EGL} so those symbols will
_not_ in fact be in the global namespace. The code also prefers checking
GLX to EGL, which means even if we initialize EGL through epoxy, and
even if we're using glvnd, we'll still dlopen libGL the first time we
hit epoxy_is_desktop_gl().

There's a couple of ways to skin this cat, let's take the easy one. If
either-but-not-both of the glx or egl handles in the global API state
are initialized, then we know we're already in one or the other. If
neither or both are initialized, then the current heuristic should work
fine.

Note that epoxy_is_desktop_gl() is only bothering to check for GLX to
work around PowerVR's broken GLES. One suspects a better way to do that
would be to check GL_VENDOR or GL_RENDERER and avoid probing the window
system at all.

Signed-off-by: Adam Jackson <ajax@redhat.com>
macos/v1.5.9
Adam Jackson 7 years ago
parent f81274b124
commit 7c4817f2ee
  1. 11
      src/dispatch_common.c

@ -522,6 +522,16 @@ epoxy_current_context_is_glx(void)
#if !PLATFORM_HAS_GLX
return false;
#else
void *sym;
/* If we've been called already, don't load more */
if (!api.egl_handle != !api.glx_handle) {
if (api.glx_handle)
return true;
else if (api.egl_handle)
return false;
}
/* If the application hasn't explicitly called some of our GLX
* or EGL code but has presumably set up a context on its own,
* then we need to figure out how to getprocaddress anyway.
@ -529,7 +539,6 @@ epoxy_current_context_is_glx(void)
* If there's a public GetProcAddress loaded in the
* application's namespace, then use that.
*/
void *sym;
sym = dlsym(NULL, "glXGetCurrentContext");
if (sym) {

Loading…
Cancel
Save