From 4ec1d5e70ca7e83e1c8191c5910a226ddfa0be98 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 18 Sep 2020 10:01:14 -0400 Subject: [PATCH] zink: add helper function for cycling a batch this saves a bit of typing here and there Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/gallium/drivers/zink/zink_context.c | 11 +++++++++++ src/gallium/drivers/zink/zink_context.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 284b2f61a7d..2d7a9aab654 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -973,6 +973,17 @@ zink_flush_compute(struct zink_context *ctx) zink_start_batch(ctx, &ctx->compute_batch); } +struct zink_batch * +zink_flush_batch(struct zink_context *ctx, struct zink_batch *batch) +{ + if (batch && batch->batch_id >= ZINK_COMPUTE_BATCH_ID) { + zink_flush_compute(ctx); + return &ctx->compute_batch; + } + flush_batch(ctx); + return zink_curr_batch(ctx); +} + static void zink_set_framebuffer_state(struct pipe_context *pctx, const struct pipe_framebuffer_state *state) diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 0e286c3c937..a7c8d575f5c 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -233,6 +233,9 @@ zink_wait_on_batch(struct zink_context *ctx, int batch_id); void zink_flush_compute(struct zink_context *ctx); +struct zink_batch * +zink_flush_batch(struct zink_context *ctx, struct zink_batch *batch); + bool zink_resource_access_is_write(VkAccessFlags flags);