zink: add helper function for cycling a batch

this saves a bit of typing here and there

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9348>
This commit is contained in:
Mike Blumenkrantz 2020-09-18 10:01:14 -04:00 committed by Marge Bot
parent 7ae8509673
commit 4ec1d5e70c
2 changed files with 14 additions and 0 deletions

View File

@ -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)

View File

@ -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);