diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 4fc16766408..f5b48f90b67 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -602,6 +602,9 @@ zink_gfx_program_update(struct zink_context *ctx) struct hash_table *ht = &ctx->program_cache[zink_program_cache_stages(ctx->shader_stages)]; const uint32_t hash = ctx->gfx_hash; struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(ht, hash, ctx->gfx_stages); + /* this must be done before prog is updated */ + if (ctx->curr_program) + ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; if (entry) { prog = (struct zink_gfx_program*)entry->data; for (unsigned i = 0; i < ZINK_GFX_SHADER_COUNT; i++) { @@ -622,8 +625,6 @@ zink_gfx_program_update(struct zink_context *ctx) simple_mtx_unlock(&ctx->program_lock[zink_program_cache_stages(ctx->shader_stages)]); if (prog && prog != ctx->curr_program) zink_batch_reference_program(&ctx->batch, &prog->base); - if (ctx->curr_program) - ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; ctx->curr_program = prog; ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; ctx->gfx_dirty = false;