diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 95b33321aa5..38c5e47bacd 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1149,6 +1149,20 @@ zink_fence_wait(struct pipe_context *pctx) } } +void +zink_wait_on_batch(struct zink_context *ctx, int batch_id) +{ + if (batch_id >= 0) { + struct zink_batch *batch = &ctx->batches[batch_id]; + if (batch != zink_curr_batch(ctx)) { + ctx->base.screen->fence_finish(ctx->base.screen, NULL, (struct pipe_fence_handle*)batch->fence, + PIPE_TIMEOUT_INFINITE); + return; + } + } + zink_fence_wait(&ctx->base); +} + static void zink_memory_barrier(struct pipe_context *pctx, unsigned flags) { diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 7f6d85858f5..1c319144066 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -189,6 +189,9 @@ zink_batch_no_rp(struct zink_context *ctx); void zink_fence_wait(struct pipe_context *ctx); +void +zink_wait_on_batch(struct zink_context *ctx, int batch_id); + void zink_resource_barrier(VkCommandBuffer cmdbuf, struct zink_resource *res, VkImageAspectFlags aspect, VkImageLayout new_layout);