]> git.cworth.org Git - fips/commit
glwrap: Don't hardcode "libGL.so.1" for looking up real OpenGL symbols
authorCarl Worth <cworth@cworth.org>
Wed, 3 Jul 2013 00:33:12 +0000 (17:33 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 3 Jul 2013 00:37:49 +0000 (17:37 -0700)
commitd6ac766abe401b681282cdcf273e7fb67fff99bd
tree23fa89fbe9d91ae34b2f629391b3633038f4c0ef
parentbf449ac6d282ad726817c4413eb2c310adba2316
glwrap: Don't hardcode "libGL.so.1" for looking up real OpenGL symbols

As preparation for testing using GLESv2 we need to ensure that our GL
wrappers are prepared for an OpenGL implementation in either the
libGL.so.1 library or in libGLESv2.so.2.

When the application is directly linked to an OpenGL implementation,
we don't care about the name at all. In this case, we can simply call
dlsym with RTLD_NEXT to find the real, underlying OpenGL symbols.

But when an application uses dlopen to load the OpenGL library, we
want to carefully call dlsym with a handle for the same library that
the application uses. Previously, the glwrap code was unconditionally
calling dlopen for "libGL.so" and that's not what we want.

Instead, we now have our dlopen wrapper watch for any dlopen of a
library whose name begins with "libGL" and then stashing the returned
handle via a new glwrap_set_gl_handle call. The stashed handle will
then be used by dlsym calls within glwrap.
dlwrap.c
dlwrap.h
glwrap.c
glwrap.h