Cache FBConfig used for shadows
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
8922312e42
commit
24370f44e6
33
src/render.c
33
src/render.c
|
@ -38,31 +38,38 @@
|
|||
static inline bool paint_bind_tex(session_t *ps, paint_t *ppaint, unsigned wid, unsigned hei,
|
||||
unsigned depth, xcb_visualid_t visual, bool force) {
|
||||
#ifdef CONFIG_OPENGL
|
||||
// XXX This is a mess. But this will go away after the backend refactor.
|
||||
static thread_local struct glx_fbconfig_info *argb_fbconfig = NULL;
|
||||
if (!ppaint->pixmap)
|
||||
return false;
|
||||
|
||||
xcb_render_pictforminfo_t *pictfmt = NULL;
|
||||
xcb_render_pictforminfo_t tmp_pictfmt = {.direct =
|
||||
struct glx_fbconfig_info *fbcfg;
|
||||
if (!visual) {
|
||||
assert(depth == 32);
|
||||
if (!argb_fbconfig) {
|
||||
xcb_render_pictforminfo_t tmp_pictfmt = {
|
||||
.direct =
|
||||
{
|
||||
.red_mask = 255,
|
||||
.blue_mask = 255,
|
||||
.green_mask = 255,
|
||||
.alpha_mask = depth == 32 ? 255 : 0,
|
||||
.alpha_mask = 255,
|
||||
},
|
||||
.type = XCB_RENDER_PICT_TYPE_DIRECT};
|
||||
|
||||
argb_fbconfig = glx_find_fbconfig(ps->dpy, ps->scr, &tmp_pictfmt, 32);
|
||||
}
|
||||
if (!argb_fbconfig) {
|
||||
log_error("Failed to find appropriate FBConfig for 32 bit depth");
|
||||
return false;
|
||||
}
|
||||
fbcfg = argb_fbconfig;
|
||||
} else {
|
||||
xcb_render_pictforminfo_t *pictfmt = x_get_pictform_for_visual(ps->c, visual);
|
||||
if (!depth) {
|
||||
assert(visual);
|
||||
depth = x_get_visual_depth(ps->c, visual);
|
||||
}
|
||||
|
||||
if (!visual) {
|
||||
assert(depth);
|
||||
pictfmt = &tmp_pictfmt;
|
||||
} else {
|
||||
pictfmt = x_get_pictform_for_visual(ps->c, visual);
|
||||
}
|
||||
|
||||
if (!pictfmt) {
|
||||
return false;
|
||||
}
|
||||
|
@ -74,9 +81,11 @@ static inline bool paint_bind_tex(session_t *ps, paint_t *ppaint, unsigned wid,
|
|||
log_error("Failed to find appropriate FBConfig for X pixmap");
|
||||
return false;
|
||||
}
|
||||
fbcfg = ppaint->fbcfg;
|
||||
}
|
||||
|
||||
if (force || !glx_tex_binded(ppaint->ptex, ppaint->pixmap))
|
||||
return glx_bind_pixmap(ps, &ppaint->ptex, ppaint->pixmap, wid, hei, ppaint->fbcfg);
|
||||
return glx_bind_pixmap(ps, &ppaint->ptex, ppaint->pixmap, wid, hei, fbcfg);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue