From d2d8a978e4f2e0564826dbd45f496ab7a696b624 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 11 Jan 2017 18:20:49 +0000 Subject: [PATCH] When creating a dummy shared context, create a pbuffer * It's not valid to try and bind a context with no drawable. --- renderdoc/driver/gl/gl_hooks_linux.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index 50b41c27f..6e520d8c9 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -498,11 +498,13 @@ public: PFNGLXISDIRECTPROC glXIsDirectProc = (PFNGLXISDIRECTPROC)dlsym(RTLD_NEXT, "glXIsDirect"); PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfigProc = (PFNGLXCHOOSEFBCONFIGPROC)dlsym(RTLD_NEXT, "glXChooseFBConfig"); + PFNGLXCREATEPBUFFERPROC glXCreatePbufferProc = + (PFNGLXCREATEPBUFFERPROC)dlsym(RTLD_NEXT, "glXCreatePbuffer"); if(glXIsDirectProc) is_direct = glXIsDirectProc(share.dpy, share.ctx); - if(glXChooseFBConfigProc) + if(glXChooseFBConfigProc && glXCreatePbufferProc) { // don't need to care about the fb config as we won't be using the default framebuffer // (backbuffer) @@ -511,8 +513,12 @@ public: GLXFBConfig *fbcfg = glXChooseFBConfigProc(share.dpy, DefaultScreen(share.dpy), visAttribs, &numCfgs); + // don't care about pbuffer properties as we won't render directly to this + int pbAttribs[] = {GLX_PBUFFER_WIDTH, 32, GLX_PBUFFER_HEIGHT, 32, 0}; + if(fbcfg) { + ret.wnd = glXCreatePbufferProc(share.dpy, fbcfg[0], pbAttribs); ret.dpy = share.dpy; ret.ctx = glXCreateContextAttribsARB_real(share.dpy, fbcfg[0], share.ctx, is_direct, attribs); @@ -524,6 +530,12 @@ public: void DeleteContext(GLWindowingData context) { + PFNGLXDESTROYPBUFFERPROC glXDestroyPbufferProc = + (PFNGLXDESTROYPBUFFERPROC)dlsym(RTLD_NEXT, "glXDestroyPbuffer"); + + if(context.wnd && glXDestroyPbufferProc) + glXDestroyPbufferProc(context.dpy, context.wnd); + if(context.ctx && glXDestroyContext_real) glXDestroyContext_real(context.dpy, context.ctx); }