From 0cbf3baaee6dcaf1474bc90559bc7e30b191b6ea Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 18 Jun 2026 11:51:48 -0400 Subject: [PATCH] zink: properly invalidate fb attachments on dontcare stores Part-of: --- src/gallium/drivers/zink/zink_context.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index c9ff737c633..4d9c258a338 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3575,11 +3575,22 @@ zink_batch_no_rp_safe(struct zink_context *ctx) } } ctx->in_rp = false; - for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) + for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) { ctx->dynamic_fb.attachments[i].resolveImageView = VK_NULL_HANDLE; + if (ctx->fb_state.cbufs[i].texture && ctx->dynamic_fb.attachments[i].storeOp == VK_ATTACHMENT_STORE_OP_DONT_CARE) + zink_resource(ctx->fb_state.cbufs[i].texture)->valid = false; + } if (ctx->fb_state.zsbuf.texture) { ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS].resolveImageView = VK_NULL_HANDLE; ctx->dynamic_fb.attachments[PIPE_MAX_COLOR_BUFS + 1].resolveImageView = VK_NULL_HANDLE; + if (ctx->fb_state.zsbuf.texture) { + bool has_depth = util_format_has_depth(util_format_description(ctx->fb_state.zsbuf.texture->format)); + bool has_stencil = util_format_has_stencil(util_format_description(ctx->fb_state.zsbuf.texture->format)); + bool depth_invalidate = !has_depth || (ctx->dynamic_fb.info.pDepthAttachment && ctx->dynamic_fb.info.pDepthAttachment->storeOp == VK_ATTACHMENT_STORE_OP_DONT_CARE); + bool stencil_invalidate = !has_stencil || (ctx->dynamic_fb.info.pStencilAttachment && ctx->dynamic_fb.info.pStencilAttachment->storeOp == VK_ATTACHMENT_STORE_OP_DONT_CARE); + if (depth_invalidate && stencil_invalidate) + zink_resource(ctx->fb_state.zsbuf.texture)->valid = false; + } } ctx->rp_draw = false; }