Skip to content

Commit

Permalink
Allow libopengl.so to be used when GLX_LIB is missing
Browse files Browse the repository at this point in the history
This maintains compatibility with previous behavior of
always using GLX_LIB if it is found. The only change is
when there is no GLX_LIB.

Previous behavior when no GLX_LIB:
- abort.

New behavior when no GLX_LIB:
- Try to load libOpenGL.so as gl_handle (glx_handle remains NULL).
- Else, abort.
  • Loading branch information
John Bates committed Jun 17, 2021
1 parent ad723a7 commit 8919ece
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/dispatch_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,20 @@ epoxy_load_gl(void)
get_dlopen_handle(&api.gl_handle, OPENGL_LIB, true, true);
#else

// Prefer GLX_LIB over OPENGL_LIB to maintain existing behavior.
get_dlopen_handle(&api.glx_handle, GLX_LIB, false, true);
api.gl_handle = api.glx_handle;

#if defined(OPENGL_LIB)
if (!api.gl_handle)
get_dlopen_handle(&api.gl_handle, OPENGL_LIB, false, true);
get_dlopen_handle(&api.gl_handle, OPENGL_LIB, false, true);
#endif

get_dlopen_handle(&api.glx_handle, GLX_LIB, true, true);
api.gl_handle = api.glx_handle;
if (!api.gl_handle) {
fprintf(stderr, "Couldn't open %s or %s\n", GLX_LIB, OPENGL_LIB);
abort();
}

#endif
}

Expand Down

0 comments on commit 8919ece

Please sign in to comment.