From c5e58a6024c713c67eaad5a1966b7ac9f60a074a Mon Sep 17 00:00:00 2001 From: derhass Date: Mon, 10 Apr 2023 14:10:20 +0200 Subject: [PATCH] Improve robustness of fbconfig selection for cloned GL context (glX) The glXGetConfig(..., GLX_FBCONFIG_ID, &fbcfgID) call does not work reliably on many implementations. In this case, all available fbconfigs are queried and the first one is chosen, but this might be incompatible to the visual of the window, resulting in a failure when the cloned context is made current for the first time (issue: #2898). This adds a fallback to query the fbconfig ID from the GL context if querying it from the VisualInfo failed. --- renderdoc/driver/gl/glx_platform.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renderdoc/driver/gl/glx_platform.cpp b/renderdoc/driver/gl/glx_platform.cpp index 91b748664..84e5aeb39 100644 --- a/renderdoc/driver/gl/glx_platform.cpp +++ b/renderdoc/driver/gl/glx_platform.cpp @@ -81,6 +81,10 @@ class GLXPlatform : public GLPlatform { int fbcfgID = -1; GLX.glXGetConfig(share.dpy, share.cfg, GLX_FBCONFIG_ID, &fbcfgID); + + if(fbcfgID == -1) + GLX.glXQueryContext(share.dpy, share.ctx, GLX_FBCONFIG_ID, &fbcfgID); + if(fbcfgID != -1) { visAttribs[i++] = GLX_FBCONFIG_ID;