zink: add a texture barrier hook

this just flushes all the pending batches, which is enough since we
do our batch work synchronously and everything is awful

will be reworked when this is no longer the case

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8948>
This commit is contained in:
Mike Blumenkrantz
2020-08-18 17:12:27 -04:00
committed by Marge Bot
parent 802c1afe9c
commit 79fcea9475
+13
View File
@@ -1286,6 +1286,18 @@ zink_wait_on_batch(struct zink_context *ctx, int batch_id)
zink_fence_wait(&ctx->base);
}
static void
zink_texture_barrier(struct pipe_context *pctx, unsigned flags)
{
struct zink_context *ctx = zink_context(pctx);
if (zink_curr_batch(ctx)->has_draw)
pctx->flush(pctx, NULL, 0);
if (ctx->compute_batch.has_draw) {
zink_end_batch(ctx, &ctx->compute_batch);
zink_start_batch(ctx, &ctx->compute_batch);
}
}
static void
zink_memory_barrier(struct pipe_context *pctx, unsigned flags)
{
@@ -1668,6 +1680,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->base.launch_grid = zink_launch_grid;
ctx->base.flush = zink_flush;
ctx->base.memory_barrier = zink_memory_barrier;
ctx->base.texture_barrier = zink_texture_barrier;
ctx->base.resource_copy_region = zink_resource_copy_region;
ctx->base.blit = zink_blit;