zink: add a read barrier for indirect dispatch
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 15 Oct 2021 15:57:14 +0000 (11:57 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 19 Oct 2021 00:17:00 +0000 (00:17 +0000)
using the draw stage here doesn't make much sense, but that's what the
spec says, so let's git er done

fixes dEQP-GL45.functional.compute.indirect_dispatch* on radv

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

src/gallium/drivers/zink/zink_draw.cpp

index 8508877..0a38c33 100644 (file)
@@ -896,6 +896,14 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
    batch->work_count++;
    zink_batch_no_rp(ctx);
    if (info->indirect) {
+      /*
+         VK_ACCESS_INDIRECT_COMMAND_READ_BIT specifies read access to indirect command data read as
+         part of an indirect build, trace, drawing or dispatching command. Such access occurs in the
+         VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT pipeline stage.
+
+         - Chapter 7. Synchronization and Cache Control
+       */
+      check_buffer_barrier(ctx, info->indirect, VK_ACCESS_INDIRECT_COMMAND_READ_BIT, VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT);
       VKCTX(CmdDispatchIndirect)(batch->state->cmdbuf, zink_resource(info->indirect)->obj->buffer, info->indirect_offset);
       zink_batch_reference_resource_rw(batch, zink_resource(info->indirect), false);
    } else