From e5c8ed73db86742dc3a2f0164bb9fe4b5885b0f6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 8 Sep 2025 10:12:58 -0400 Subject: [PATCH] zink: toggle ctx->has_swapchain when flushing clears this otherwise breaks resolve handling Fixes: b122c3eaa9e ("zink: unify/fix clear flushing") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13841 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13847 Part-of: (cherry picked from commit 504a522a1ea0dc638373db970a3d9979b92f79d7) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_context.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 785006a6b03..ba8ece6a800 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -7584,7 +7584,7 @@ "description": "zink: toggle ctx->has_swapchain when flushing clears", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "b122c3eaa9eff5c5c778d7dd7e06614b21a8c55b", "notes": null diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 9eea8c2482a..9adda460ee2 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3380,11 +3380,14 @@ zink_flush_clears(struct zink_context *ctx) struct zink_screen *screen = zink_screen(ctx->base.screen); bool general_layout = screen->driver_workarounds.general_layout; bool queries_disabled = ctx->queries_disabled; + bool has_swapchain = ctx->has_swapchain; bool blitting = ctx->blitting; struct pipe_framebuffer_state fb = ctx->fb_state; if (!blitting) { for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) { if (!ctx->fb_state.cbufs[i].texture || !zink_fb_clear_enabled(ctx, i)) { + if (ctx->fb_state.cbufs[i].texture && zink_is_swapchain(zink_resource(ctx->fb_state.cbufs[i].texture))) + ctx->has_swapchain = false; ctx->fb_state.cbufs[i].texture = NULL; continue; } @@ -3418,6 +3421,7 @@ zink_flush_clears(struct zink_context *ctx) zink_batch_rp(ctx); ctx->queries_disabled = queries_disabled; ctx->blitting = blitting; + ctx->has_swapchain = has_swapchain; if (!blitting) ctx->fb_state = fb; }