diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index ed79f2935..ba8acef33 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -42,6 +42,7 @@ typedef XVisualInfo *(*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display *dpy, GLXFBConfi typedef int (*PFNGLXGETCONFIGPROC)(Display *dpy, XVisualInfo *vis, int attrib, int *value); typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display *dpy, int *errorBase, int *eventBase); typedef Bool (*PFNGLXISDIRECTPROC)(Display *dpy, GLXContext ctx); +typedef __GLXextFuncPtr (*PFNGLXGETPROCADDRESSARBPROC)(const GLubyte *procName); class OpenGLHook : LibraryHook, public GLPlatform { @@ -363,6 +364,7 @@ public: PFNGLXDESTROYCONTEXTPROC glXDestroyContext_real; PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB_real; PFNGLXGETPROCADDRESSPROC glXGetProcAddress_real; + PFNGLXGETPROCADDRESSARBPROC glXGetProcAddressARB_real; PFNGLXMAKECURRENTPROC glXMakeCurrent_real; PFNGLXMAKECONTEXTCURRENTPROC glXMakeContextCurrent_real; PFNGLXSWAPBUFFERSPROC glXSwapBuffers_real; @@ -388,6 +390,9 @@ public: if(glXGetProcAddress_real == NULL) glXGetProcAddress_real = (PFNGLXGETPROCADDRESSPROC)dlsym(libGLdlsymHandle, "glXGetProcAddress"); + if(glXGetProcAddressARB_real == NULL) + glXGetProcAddressARB_real = + (PFNGLXGETPROCADDRESSPROC)dlsym(libGLdlsymHandle, "glXGetProcAddressARB"); if(glXCreateContext_real == NULL) glXCreateContext_real = (PFNGLXCREATECONTEXTPROC)dlsym(libGLdlsymHandle, "glXCreateContext"); if(glXDestroyContext_real == NULL) @@ -418,6 +423,15 @@ public: if(glXQueryDrawable_real == NULL) glXQueryDrawable_real = (PFNGLXQUERYDRAWABLEPROC)dlsym(RTLD_NEXT, "glXQueryDrawable"); + // glXCreateContextAttribsARB may not be directly exported by libGL.so, so try to fetch it + // through the glXGetProcAddress function, favouring the ARB variant. + if(glXCreateContextAttribsARB_real == NULL && glXGetProcAddressARB_real) + glXCreateContextAttribsARB_real = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddressARB_real( + (const GLubyte *)"glXCreateContextAttribsARB"); + if(glXCreateContextAttribsARB_real == NULL && glXGetProcAddress_real) + glXCreateContextAttribsARB_real = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress_real( + (const GLubyte *)"glXCreateContextAttribsARB"); + return success; }