zink: when skipping a TRANSFER_DST image barrier, set access tracking
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 1 Mar 2023 16:42:41 +0000 (11:42 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 6 Mar 2023 14:22:01 +0000 (14:22 +0000)
this otherwise breaks subsequent barriers if the first barrier of the batch
is a TRANSFER_DST on an image that can skip such a barrier

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

src/gallium/drivers/zink/zink_context.c

index b62e9ea..f88fe89 100644 (file)
@@ -3809,8 +3809,12 @@ void
 zink_resource_image_transfer_dst_barrier(struct zink_context *ctx, struct zink_resource *res, unsigned level, const struct pipe_box *box)
 {
    /* skip TRANSFER_DST barrier if no intersection from previous copies */
-   if (res->layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL || zink_resource_copy_box_intersects(res, level, box))
+   if (res->layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL || zink_resource_copy_box_intersects(res, level, box)) {
       zink_screen(ctx->base.screen)->image_barrier(ctx, res, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
+   } else {
+      res->obj->access = VK_ACCESS_TRANSFER_WRITE_BIT;
+      res->obj->access_stage = VK_PIPELINE_STAGE_TRANSFER_BIT;
+   }
    zink_resource_copy_box_add(res, level, box);
 
 }