From 00bc75439f02cd8041e42b48ba1ecff7610fce1d Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Thu, 9 May 2024 18:40:31 +0300 Subject: [PATCH] render/vulkan: fix texture clip region leak --- render/vulkan/pass.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c index 5e5d0079..d4a91b85 100644 --- a/render/vulkan/pass.c +++ b/render/vulkan/pass.c @@ -619,9 +619,6 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass, wlr_render_texture_options_get_dst_box(options, &dst_box); float alpha = wlr_render_texture_options_get_alpha(options); - pixman_region32_t clip; - get_clip_region(pass, options->clip, &clip); - float proj[9], matrix[9]; wlr_matrix_identity(proj); wlr_matrix_project_box(matrix, &dst_box, options->transform, 0, proj); @@ -677,6 +674,9 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass, VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(vert_pcr_data), sizeof(float), &alpha); + pixman_region32_t clip; + get_clip_region(pass, options->clip, &clip); + int clip_rects_len; const pixman_box32_t *clip_rects = pixman_region32_rectangles(&clip, &clip_rects_len); for (int i = 0; i < clip_rects_len; i++) { @@ -699,6 +699,8 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass, } texture->last_used_cb = pass->command_buffer; + + pixman_region32_fini(&clip); } static const struct wlr_render_pass_impl render_pass_impl = {