zink: skip attachment barrier for redundant layout-setting if !valid
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 27 Feb 2023 16:05:06 +0000 (11:05 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 6 Mar 2023 14:22:01 +0000 (14:22 +0000)
an invalidated image doesn't need synchronization, so this can be skipped

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21583>

src/gallium/drivers/zink/zink_context.c

index 1f3be4d..a677714 100644 (file)
@@ -2868,7 +2868,8 @@ zink_prep_fb_attachment(struct zink_context *ctx, struct zink_surface *surf, uns
    else if (!zink_screen(ctx->base.screen)->info.have_EXT_attachment_feedback_loop_layout &&
             layout == VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT)
       layout = VK_IMAGE_LAYOUT_GENERAL;
-   zink_screen(ctx->base.screen)->image_barrier(ctx, res, layout, access, pipeline);
+   if (res->valid || res->layout != layout)
+      zink_screen(ctx->base.screen)->image_barrier(ctx, res, layout, access, pipeline);
    res->obj->unordered_read = res->obj->unordered_write = false;
    if (i == ctx->fb_state.nr_cbufs && res->sampler_bind_count[0])
       update_res_sampler_layouts(ctx, res);