diff --git a/src/common.h b/src/common.h index 84a42ce..542c31f 100644 --- a/src/common.h +++ b/src/common.h @@ -214,6 +214,7 @@ typedef struct session { /// Custom GLX program used for painting window. // XXX should be in struct glx_session glx_prog_main_t glx_prog_win; + struct glx_fbconfig_info *argb_fbconfig; #endif /// Sync fence to sync draw operations xcb_sync_fence_t sync_fence; diff --git a/src/opengl.c b/src/opengl.c index 40945cb..069eaac 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -252,6 +252,7 @@ void glx_destroy(session_t *ps) { free(ps->psglx); ps->psglx = NULL; + ps->argb_fbconfig = NULL; } /** diff --git a/src/render.c b/src/render.c index c0e33e3..9859b0f 100644 --- a/src/render.c +++ b/src/render.c @@ -48,15 +48,14 @@ static inline bool paint_bind_tex(session_t *ps, paint_t *ppaint, int wid, int h bool repeat, int 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; struct glx_fbconfig_info *fbcfg; if (!visual) { assert(depth == 32); - if (!argb_fbconfig) { - argb_fbconfig = + if (!ps->argb_fbconfig) { + ps->argb_fbconfig = glx_find_fbconfig(ps->dpy, ps->scr, (struct xvisual_info){.red_size = 8, .green_size = 8, @@ -64,11 +63,11 @@ static inline bool paint_bind_tex(session_t *ps, paint_t *ppaint, int wid, int h .alpha_size = 8, .visual_depth = 32}); } - if (!argb_fbconfig) { + if (!ps->argb_fbconfig) { log_error("Failed to find appropriate FBConfig for 32 bit depth"); return false; } - fbcfg = argb_fbconfig; + fbcfg = ps->argb_fbconfig; } else { auto m = x_get_visual_info(ps->c, visual); if (m.visual_depth < 0) {