From faf1f086dff8047b7c43d79f20fe222105afd541 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Mar 2016 10:54:32 +0800 Subject: [PATCH] Check for glXIsDirect in MakeContext Create a direct renerding context when the shared context is too. Otherwise, I got this error X Error of failed request: BadMatch (invalid parameter attributes) on nVidia. --- renderdoc/driver/gl/gl_hooks_linux.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index 8cea7e5e8..70efbbb6c 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -50,6 +50,7 @@ typedef void (*PFNGLXSWAPBUFFERSPROC)(Display *dpy, GLXDrawable drawable); typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display *dpy, GLXFBConfig config); 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); void *libGLdlsymHandle = RTLD_NEXT; // default to RTLD_NEXT, but overwritten if app calls dlopen() on real libGL @@ -336,9 +337,14 @@ class OpenGLHook : LibraryHook GLX_CONTEXT_CORE_PROFILE_BIT_ARB, 0, 0, }; + bool is_direct = false; + PFNGLXISDIRECTPROC glXIsDirectProc = (PFNGLXISDIRECTPROC)dlsym(RTLD_NEXT, "glXIsDirect"); PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfigProc = (PFNGLXCHOOSEFBCONFIGPROC)dlsym(RTLD_NEXT, "glXChooseFBConfig"); + if (glXIsDirectProc) + is_direct = glXIsDirectProc(share.dpy, share.ctx); + if(glXChooseFBConfigProc) { // don't need to care about the fb config as we won't be using the default framebuffer (backbuffer) @@ -349,7 +355,7 @@ class OpenGLHook : LibraryHook if(fbcfg) { ret.dpy = share.dpy; - ret.ctx = glXCreateContextAttribsARB_real(share.dpy, fbcfg[0], share.ctx, false, attribs); + ret.ctx = glXCreateContextAttribsARB_real(share.dpy, fbcfg[0], share.ctx, is_direct, attribs); } } }