diff options
author | Richard Grenville <[email protected]> | 2013-07-05 23:21:05 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2013-07-05 23:22:58 +0800 |
commit | bd40b36f01e2f114b0647ec7365550fb9f610326 (patch) | |
tree | 43143a7e1dbc13217ece93a2161803610f2a99ee /opengl.c | |
parent | 291fba3b6dc0e24ca7e5e17bbca5e7fa5ff51ca0 (diff) | |
download | tdebase-bd40b36f01e2f114b0647ec7365550fb9f610326.tar.gz tdebase-bd40b36f01e2f114b0647ec7365550fb9f610326.zip |
Bug fix #124: GLX: Missing check on FBConfig X visual depth
- Check FBConfig X visual depth, like Compiz, to fix issues with
nvidia-drivers-325.08 . Thanks to guotsuan for reporting.
Diffstat (limited to 'opengl.c')
-rw-r--r-- | opengl.c | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -383,18 +383,31 @@ glx_update_fbconfig(session_t *ps) { .texture_tgts = 0, .y_inverted = false, }; + int id = (int) (pcur - pfbcfgs); int depth = 0, depth_alpha = 0, val = 0; if (Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BUFFER_SIZE, &depth) || Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_ALPHA_SIZE, &depth_alpha)) { - printf_errf("(): Failed to retrieve buffer size and alpha size of FBConfig %d.", (int) (pcur - pfbcfgs)); + printf_errf("(): Failed to retrieve buffer size and alpha size of FBConfig %d.", id); continue; } if (Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BIND_TO_TEXTURE_TARGETS_EXT, &fbinfo.texture_tgts)) { - printf_errf("(): Failed to retrieve BIND_TO_TEXTURE_TARGETS_EXT of FBConfig %d.", (int) (pcur - pfbcfgs)); + printf_errf("(): Failed to retrieve BIND_TO_TEXTURE_TARGETS_EXT of FBConfig %d.", id); continue; } + int visualdepth = 0; + { + XVisualInfo *pvi = glXGetVisualFromFBConfig(ps->dpy, *pcur); + if (!pvi) { + // On nvidia-drivers-325.08 this happens slightly too often... + // printf_errf("(): Failed to retrieve X Visual of FBConfig %d.", id); + continue; + } + visualdepth = pvi->depth; + cxfree(pvi); + } + bool rgb = false; bool rgba = false; @@ -407,12 +420,15 @@ glx_update_fbconfig(session_t *ps) { if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_Y_INVERTED_EXT, &val)) fbinfo.y_inverted = val; - if ((depth - depth_alpha) < 32 && rgb) { - fbinfo.texture_fmt = GLX_TEXTURE_FORMAT_RGB_EXT; - glx_update_fbconfig_bydepth(ps, depth - depth_alpha, &fbinfo); + { + int tgtdpt = depth - depth_alpha; + if (tgtdpt == visualdepth && tgtdpt < 32 && rgb) { + fbinfo.texture_fmt = GLX_TEXTURE_FORMAT_RGB_EXT; + glx_update_fbconfig_bydepth(ps, tgtdpt, &fbinfo); + } } - if (rgba) { + if (depth == visualdepth && rgba) { fbinfo.texture_fmt = GLX_TEXTURE_FORMAT_RGBA_EXT; glx_update_fbconfig_bydepth(ps, depth, &fbinfo); } |