From f19766f15a24976c475e966e85192ee69bb79810 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 3 Feb 2019 19:33:28 +0000 Subject: [PATCH] Fix FBConfig cost calculation Double buffering only doubles the color buffer, not the depth and stencil. Signed-off-by: Yuxuan Shui --- src/backend/gl/glx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/gl/glx.c b/src/backend/gl/glx.c index 4e39e92..2b036cc 100644 --- a/src/backend/gl/glx.c +++ b/src/backend/gl/glx.c @@ -105,7 +105,7 @@ glx_find_fbconfig(Display *dpy, int screen, xcb_render_pictforminfo_t *pictfmt, glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_DEPTH_SIZE, &depthbuf); glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_STENCIL_SIZE, &stencil); glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_DOUBLEBUFFER, &doublebuf); - if ((depthbuf + stencil + bufsize) * (doublebuf + 1) >= min_cost) { + if (depthbuf + stencil + bufsize * (doublebuf + 1) >= min_cost) { continue; } int red, green, blue; @@ -149,7 +149,7 @@ glx_find_fbconfig(Display *dpy, int screen, xcb_render_pictforminfo_t *pictfmt, } else { texture_fmt = rgb ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT; } - min_cost = (depthbuf + stencil + bufsize) * (doublebuf + 1); + min_cost = depthbuf + stencil + bufsize * (doublebuf + 1); } #undef glXGetFBConfigAttribChecked free(cfg);