Fix FBConfig cost calculation

Double buffering only doubles the color buffer, not the depth and
stencil.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-03 19:33:28 +00:00
parent 2263bab2ff
commit f19766f15a
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 2 additions and 2 deletions

View File

@ -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_DEPTH_SIZE, &depthbuf);
glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_STENCIL_SIZE, &stencil); glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_STENCIL_SIZE, &stencil);
glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_DOUBLEBUFFER, &doublebuf); glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_DOUBLEBUFFER, &doublebuf);
if ((depthbuf + stencil + bufsize) * (doublebuf + 1) >= min_cost) { if (depthbuf + stencil + bufsize * (doublebuf + 1) >= min_cost) {
continue; continue;
} }
int red, green, blue; int red, green, blue;
@ -149,7 +149,7 @@ glx_find_fbconfig(Display *dpy, int screen, xcb_render_pictforminfo_t *pictfmt,
} else { } else {
texture_fmt = rgb ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT; 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 #undef glXGetFBConfigAttribChecked
free(cfg); free(cfg);