From 24742d490dac3b2daedc2f94254fbe63d65a776d Mon Sep 17 00:00:00 2001 From: Austin Shafer Date: Tue, 2 Aug 2022 14:24:18 -0400 Subject: [PATCH] Use wlr_texture_set Use the new wlr_texture_set type added in wlroots to better manage textures in multi-GPU environments. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4055 --- sway/desktop/render.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sway/desktop/render.c b/sway/desktop/render.c index a4d633e0..c5bf3f51 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -303,7 +303,7 @@ static void render_saved_view(struct sway_view *view, struct sway_saved_buffer *saved_buf; wl_list_for_each(saved_buf, &view->saved_buffers, link) { - if (!saved_buf->buffer->texture) { + if (!saved_buf->buffer->texture_set) { continue; } @@ -343,8 +343,14 @@ static void render_saved_view(struct sway_view *view, } scale_box(&dst_box, wlr_output->scale); - render_texture(wlr_output, damage, saved_buf->buffer->texture, - &saved_buf->source_box, &dst_box, matrix, alpha); + struct wlr_texture *texture = wlr_texture_set_get_tex_for_renderer( + saved_buf->buffer->texture_set, wlr_output->renderer); + if (!texture) { + continue; + } + + render_texture(wlr_output, damage, texture, &saved_buf->source_box, + &dst_box, matrix, alpha); } // FIXME: we should set the surface that this saved buffer originates from