Skip to content

Commit

Permalink
gltrace: Intercept libGLX.so.
Browse files Browse the repository at this point in the history
There's probably more to support glvnd than intercepting libGLX.so, as
applications can call libOpenGL.so too.  But this is enough for
applications which obtain OpenGL symbols through libGLX.so's
glXGetProcAddress(ARB).

Fixes #829
  • Loading branch information
jrfonseca committed Oct 17, 2022
1 parent 2b102b2 commit 5252cbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/USAGE.markdown
Expand Up @@ -134,6 +134,10 @@ ordinary `libGL.so` and injecting it via `LD_LIBRARY_PATH`:
export TRACE_LIBGL=/path/to/real/libGL.so.1
/path/to/application

_NOTE: This `LD_LIBRARY_PATH` approach will not work with applications which
call [glvnd](https://gitlab.freedesktop.org/glvnd/libglvnd#architecture)
components directly._

If you are an application developer, you can avoid this either by linking with
`-Bsymbolic` flag, or by using some unique prefix for your function pointers.

Expand Down
6 changes: 6 additions & 0 deletions wrappers/dlsym.cpp
Expand Up @@ -95,6 +95,7 @@ extern void * _libGlHandle;
enum LibClass {
LIB_UNKNOWN = 0,
LIB_GL,
LIB_GLX,
LIB_EGL,
LIB_GLES1,
LIB_GLES2,
Expand All @@ -114,6 +115,11 @@ classifyLibrary(const char *pathname)
return LIB_GL;
}

if (strcmp(filename, "libGLX.so") == 0 ||
strcmp(filename, "libGLX.so.0") == 0) {
return LIB_GLX;
}

#ifdef EGLTRACE
if (strcmp(filename, "libEGL.so") == 0 ||
strcmp(filename, "libEGL.so.1") == 0) {
Expand Down

0 comments on commit 5252cbd

Please sign in to comment.