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.
This commit is contained in:
derhass authored and Baldur Karlsson committed 2023-04-10 16:03:32 +01:00
1 parent 8009df5027
commit c5e58a6024
1 file changed
+4
+4
View File
@@ -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;