From c88ce857995e304ffedd9002ab4dc62733cbb443 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 11 May 2021 17:49:24 -0400 Subject: [PATCH] zink: if descriptor updating flushes, re-call draw/compute ensure upcoming template is correct for now, but this will eventually be refactored out Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_draw.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index c56edb6bb73..47ace7cc396 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -439,8 +439,13 @@ zink_draw_vbo(struct pipe_context *pctx, ctx->gfx_prim_mode = dinfo->mode; update_gfx_program(ctx); - if (zink_program_has_descriptors(&ctx->curr_program->base)) - screen->descriptors_update(ctx, false); + if (zink_program_has_descriptors(&ctx->curr_program->base)) { + if (screen->descriptors_update(ctx, false)) { + /* descriptors have flushed the batch */ + pctx->draw_vbo(pctx, dinfo, drawid_offset, dindirect, draws, num_draws); + return; + } + } if (ctx->gfx_pipeline_state.primitive_restart != dinfo->primitive_restart) ctx->gfx_pipeline_state.dirty = true; @@ -751,14 +756,19 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info) update_compute_program(ctx); + if (zink_program_has_descriptors(&ctx->curr_compute->base)) { + if (screen->descriptors_update(ctx, true)) { + /* descriptors have flushed the batch */ + pctx->launch_grid(pctx, info); + return; + } + } + zink_program_update_compute_pipeline_state(ctx, ctx->curr_compute, info->block); VkPipeline prev_pipeline = ctx->compute_pipeline_state.pipeline; VkPipeline pipeline = zink_get_compute_pipeline(screen, ctx->curr_compute, &ctx->compute_pipeline_state); - if (zink_program_has_descriptors(&ctx->curr_compute->base)) - screen->descriptors_update(ctx, true); - if (ctx->descriptor_refs_dirty[1]) zink_update_descriptor_refs(ctx, true);