From 79fcea9475da1f03164a855f32c4c259007a8a19 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 18 Aug 2020 17:12:27 -0400 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/zink/zink_context.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 2b2d863b629..43625fe88cc 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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;