From e83c7f2912c1c1fdb854e905cbf2a17a1b9cb528 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 28 Aug 2025 07:55:36 -0400 Subject: [PATCH] zink: always flush clears when doing single-aspect blit to avoid data loss if doing e.g., clear(DEPTH|STENCIL) -> blit(DEPTH), the stencil clear would previously have been discarded cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_blit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_blit.c b/src/gallium/drivers/zink/zink_blit.c index b2970d4c9a9..0ff2e93defe 100644 --- a/src/gallium/drivers/zink/zink_blit.c +++ b/src/gallium/drivers/zink/zink_blit.c @@ -16,7 +16,10 @@ static void apply_dst_clears(struct zink_context *ctx, const struct pipe_blit_info *info, bool discard_only) { - if (info->scissor_enable) { + if (util_format_get_mask(info->dst.format) != info->mask) { + /* need to flush z/s clears before doing single-aspect blit to avoid data loss */ + zink_fb_clears_apply_region(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), info->dst.box.z, info->dst.box.depth); + } else if (info->scissor_enable) { struct u_rect rect = { info->scissor.minx, info->scissor.maxx, info->scissor.miny, info->scissor.maxy }; zink_fb_clears_apply_or_discard(ctx, info->dst.resource, rect, info->dst.box.z, info->dst.box.depth, discard_only);