zink: only do deferred image barriers if layout changes
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 9 Apr 2021 14:30:49 +0000 (10:30 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 24 Jun 2021 22:34:46 +0000 (22:34 +0000)
otherwise these should be handled by apps using glMemoryBarrier

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

src/gallium/drivers/zink/zink_draw.c

index 36bd732..793c60b 100644 (file)
@@ -377,7 +377,8 @@ update_barriers(struct zink_context *ctx, bool is_compute)
             zink_resource_buffer_barrier(ctx, NULL, res, access, pipeline);
          else {
             VkImageLayout layout = zink_descriptor_util_image_layout_eval(res, is_compute);
-            zink_resource_image_barrier(ctx, NULL, res, layout, access, pipeline);
+            if (layout != res->layout)
+               zink_resource_image_barrier(ctx, NULL, res, layout, access, pipeline);
          }
          /* always barrier on draw if this resource has either multiple image write binds or
           * image write binds and image read binds