From 9e0ff0ffdaf213e50228b52d76441deee86e93fb Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 20 Jun 2019 10:24:03 +0200 Subject: [PATCH] zink: more batch-ism Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_batch.c | 4 ++-- src/gallium/drivers/zink/zink_batch.h | 4 ++-- src/gallium/drivers/zink/zink_context.c | 21 ++++++++------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 7f73d26569a..0db58c6a881 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -37,7 +37,7 @@ reset_batch(struct zink_screen *screen, struct zink_batch *batch) } void -zink_start_cmdbuf(struct zink_context *ctx, struct zink_batch *batch) +zink_start_batch(struct zink_context *ctx, struct zink_batch *batch) { reset_batch(zink_screen(ctx->base.screen), batch); @@ -72,7 +72,7 @@ submit_cmdbuf(struct zink_context *ctx, VkCommandBuffer cmdbuf, VkFence fence) } void -zink_end_cmdbuf(struct zink_context *ctx, struct zink_batch *batch) +zink_end_batch(struct zink_context *ctx, struct zink_batch *batch) { if (vkEndCommandBuffer(batch->cmdbuf) != VK_SUCCESS) { debug_printf("vkEndCommandBuffer failed\n"); diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h index 49fd8a55369..d08a5d411fd 100644 --- a/src/gallium/drivers/zink/zink_batch.h +++ b/src/gallium/drivers/zink/zink_batch.h @@ -47,10 +47,10 @@ struct zink_batch { }; void -zink_start_cmdbuf(struct zink_context *ctx, struct zink_batch *batch); +zink_start_batch(struct zink_context *ctx, struct zink_batch *batch); void -zink_end_cmdbuf(struct zink_context *ctx, struct zink_batch *batch); +zink_end_batch(struct zink_context *ctx, struct zink_batch *batch); void zink_batch_reference_resoure(struct zink_batch *cmdbuf, diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index a4bd82f2230..fde12a9dd74 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -506,15 +506,6 @@ get_framebuffer(struct zink_context *ctx) return entry->data; } -static void -end_batch(struct zink_context *ctx, struct zink_batch *batch) -{ - if (batch->rp) - vkCmdEndRenderPass(batch->cmdbuf); - - zink_end_cmdbuf(ctx, batch); -} - void zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch) { @@ -546,14 +537,18 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch) static void flush_batch(struct zink_context *ctx) { - end_batch(ctx, zink_context_curr_batch(ctx)); + struct zink_batch *batch = zink_context_curr_batch(ctx); + if (batch->rp) + vkCmdEndRenderPass(batch->cmdbuf); + + zink_end_batch(ctx, batch); ctx->curr_batch++; if (ctx->curr_batch == ARRAY_SIZE(ctx->batches)) ctx->curr_batch = 0; - struct zink_batch *batch = zink_context_curr_batch(ctx); - zink_start_cmdbuf(ctx, batch); + batch = zink_context_curr_batch(ctx); + zink_start_batch(ctx, batch); } static void @@ -1385,7 +1380,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) ctx->dirty = ZINK_DIRTY_PROGRAM; /* start the first batch */ - zink_start_cmdbuf(ctx, zink_context_curr_batch(ctx)); + zink_start_batch(ctx, zink_context_curr_batch(ctx)); return &ctx->base; -- 2.30.2