zink: toggle ctx->has_swapchain when flushing clears

this otherwise breaks resolve handling

Fixes: b122c3eaa9 ("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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37234>
(cherry picked from commit 504a522a1e)
This commit is contained in:
Mike Blumenkrantz 2025-09-08 10:12:58 -04:00 committed by Eric Engestrom
parent e22ca94e68
commit e5c8ed73db
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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;
}