zink: more batch-ism

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Erik Faye-Lund 2019-06-20 10:24:03 +02:00
parent 33b2f914db
commit 9e0ff0ffda
3 changed files with 12 additions and 17 deletions

View File

@ -37,7 +37,7 @@ reset_batch(struct zink_screen *screen, struct zink_batch *batch)
} }
void 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); reset_batch(zink_screen(ctx->base.screen), batch);
@ -72,7 +72,7 @@ submit_cmdbuf(struct zink_context *ctx, VkCommandBuffer cmdbuf, VkFence fence)
} }
void 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) { if (vkEndCommandBuffer(batch->cmdbuf) != VK_SUCCESS) {
debug_printf("vkEndCommandBuffer failed\n"); debug_printf("vkEndCommandBuffer failed\n");

View File

@ -47,10 +47,10 @@ struct zink_batch {
}; };
void void
zink_start_cmdbuf(struct zink_context *ctx, struct zink_batch *batch); zink_start_batch(struct zink_context *ctx, struct zink_batch *batch);
void void
zink_end_cmdbuf(struct zink_context *ctx, struct zink_batch *batch); zink_end_batch(struct zink_context *ctx, struct zink_batch *batch);
void void
zink_batch_reference_resoure(struct zink_batch *cmdbuf, zink_batch_reference_resoure(struct zink_batch *cmdbuf,

View File

@ -506,15 +506,6 @@ get_framebuffer(struct zink_context *ctx)
return entry->data; 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 void
zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch) 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 static void
flush_batch(struct zink_context *ctx) 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++; ctx->curr_batch++;
if (ctx->curr_batch == ARRAY_SIZE(ctx->batches)) if (ctx->curr_batch == ARRAY_SIZE(ctx->batches))
ctx->curr_batch = 0; ctx->curr_batch = 0;
struct zink_batch *batch = zink_context_curr_batch(ctx); batch = zink_context_curr_batch(ctx);
zink_start_cmdbuf(ctx, batch); zink_start_batch(ctx, batch);
} }
static void static void
@ -1385,7 +1380,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->dirty = ZINK_DIRTY_PROGRAM; ctx->dirty = ZINK_DIRTY_PROGRAM;
/* start the first batch */ /* 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; return &ctx->base;