mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 04:50:35 +00:00
Fall back to creating a non-SRGB capable fbconfig. Refs #721
* In some cases it seems that no sRGB fbconfigs are available, so we fall back and create a non-SRGB one. This may render incorrectly but at least it should run without crashing.
This commit is contained in:
@@ -253,6 +253,8 @@ public:
|
||||
RDCERR("Unexpected window system %u", system);
|
||||
}
|
||||
|
||||
// GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB MUST be the last attrib so that we can remove it to retry
|
||||
// if we find no srgb fbconfigs
|
||||
static int visAttribs[] = {GLX_X_RENDERABLE,
|
||||
True,
|
||||
GLX_DRAWABLE_TYPE,
|
||||
@@ -272,9 +274,26 @@ public:
|
||||
GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB,
|
||||
True,
|
||||
0};
|
||||
|
||||
int numCfgs = 0;
|
||||
GLXFBConfig *fbcfg = glXChooseFBConfig_real(dpy, DefaultScreen(dpy), visAttribs, &numCfgs);
|
||||
|
||||
if(fbcfg == NULL)
|
||||
{
|
||||
const size_t len = ARRAY_COUNT(visAttribs);
|
||||
if(visAttribs[len - 3] != GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB)
|
||||
{
|
||||
RDCERR(
|
||||
"GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB isn't the last attribute, and no SRGB fbconfigs were "
|
||||
"found!");
|
||||
}
|
||||
else
|
||||
{
|
||||
visAttribs[len - 3] = 0;
|
||||
fbcfg = glXChooseFBConfig_real(dpy, DefaultScreen(dpy), visAttribs, &numCfgs);
|
||||
}
|
||||
}
|
||||
|
||||
if(fbcfg == NULL)
|
||||
{
|
||||
RDCERR("Couldn't choose default framebuffer config");
|
||||
|
||||
Reference in New Issue
Block a user