From f75e886bf60bb30481e00695bf997535ede94aa6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 15 Aug 2025 08:37:31 -0400 Subject: [PATCH] zink: only try update descriptors on draw/dispatch when necessary this call has a lot of overhead even if it does nothing Part-of: --- src/gallium/drivers/zink/zink_draw.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index ea04b13733a..a0e1db4f6d4 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -778,7 +778,7 @@ zink_draw(struct pipe_context *pctx, ctx->primitive_restart = dinfo->primitive_restart; } - if (zink_program_has_descriptors(&ctx->curr_program->base)) + if (zink_program_has_descriptors(&ctx->curr_program->base) && (BATCH_CHANGED || ctx->dd.push_state_changed[0] || ctx->dd.state_changed[0] || pipeline_changed)) zink_descriptors_update(ctx, ZINK_PIPELINE_GFX); if (ctx->di.any_bindless_dirty && @@ -1307,14 +1307,15 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info) VkPipeline pipeline = zink_get_compute_pipeline(screen, ctx->curr_compute, &ctx->compute_pipeline_state); - if (prev_pipeline != pipeline || BATCH_CHANGED) + bool pipeline_changed = prev_pipeline != pipeline; + if (pipeline_changed || BATCH_CHANGED) VKCTX(CmdBindPipeline)(bs->cmdbuf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline); if (BATCH_CHANGED) { ctx->pipeline_changed[1] = false; zink_select_launch_grid(ctx); } - if (zink_program_has_descriptors(&ctx->curr_compute->base)) + if (zink_program_has_descriptors(&ctx->curr_compute->base) && (BATCH_CHANGED || ctx->dd.push_state_changed[1] || ctx->dd.state_changed[1] || pipeline_changed)) zink_descriptors_update(ctx, ZINK_PIPELINE_COMPUTE); if (ctx->di.any_bindless_dirty && ctx->curr_compute->base.dd.bindless) zink_descriptors_update_bindless(ctx);