From 16946782944fa7903683e4db51115c7c2eeea260 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 27 Feb 2023 10:44:48 -0500 Subject: [PATCH] zink: avoid unnecessary read-only layout changes for zs attachments Part-of: --- src/gallium/drivers/zink/zink_context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 3be01264295..1f3be4d3f3f 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2853,6 +2853,9 @@ zink_prep_fb_attachment(struct zink_context *ctx, struct zink_surface *surf, uns else zink_init_zs_attachment(ctx, &rt); layout = zink_render_pass_attachment_get_barrier_info(&rt, i < ctx->fb_state.nr_cbufs, &pipeline, &access); + /* avoid unnecessary read-only layout change */ + if (layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL && res->layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL) + layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; } } /*