[client] x11: load glXSwapIntervalEXT dynamically

The Linux OpenGL ABI does not guarantee that glXSwapIntervalEXT will be
exported statically from any library, and indeed on some systems this
function does not link at load time, e.g. with amdgpu-pro. All other
GLX functions that we use are from GLX 1.0, which is guaranteed to be
exported statically.

This commit solves this issue by using glXGetProcAddressARB to load the
function. Note that only the ARB version of glXGetProcAddress is
guaranteed to exist by the Linux OpenGL ABI, which is why we must use
it.
This commit is contained in:
Quantum 2021-09-27 22:10:50 -04:00 committed by Geoffrey McRae
parent 1f24ab0742
commit 12840a8324

View File

@ -1315,6 +1315,14 @@ static void x11GLMakeCurrent(LG_DSGLContext context)
static void x11GLSetSwapInterval(int interval) static void x11GLSetSwapInterval(int interval)
{ {
static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
if (!glXSwapIntervalEXT)
{
glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB(
(const GLubyte *) "glXSwapIntervalEXT");
if (!glXSwapIntervalEXT)
DEBUG_FATAL("Failed to load glXSwapIntervalEXT");
}
glXSwapIntervalEXT(x11.display, x11.window, interval); glXSwapIntervalEXT(x11.display, x11.window, interval);
} }