diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 7177c31d862..9feb19a7624 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -631,6 +631,7 @@ zink_gfx_program_update_optimal(struct zink_context *ctx) { if (ctx->gfx_dirty) { struct zink_gfx_program *prog = NULL; + ctx->gfx_pipeline_state.optimal_key = ctx->gfx_pipeline_state.shader_keys_optimal.key.val; struct hash_table *ht = &ctx->program_cache[zink_program_cache_stages(ctx->shader_stages)]; const uint32_t hash = ctx->gfx_hash; simple_mtx_lock(&ctx->program_lock[zink_program_cache_stages(ctx->shader_stages)]); @@ -640,7 +641,6 @@ zink_gfx_program_update_optimal(struct zink_context *ctx) ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; if (entry) { prog = (struct zink_gfx_program*)entry->data; - ctx->gfx_pipeline_state.optimal_key = ctx->gfx_pipeline_state.shader_keys_optimal.key.val; update_gfx_program_optimal(ctx, prog); } else { ctx->dirty_gfx_stages |= ctx->shader_stages; @@ -655,6 +655,7 @@ zink_gfx_program_update_optimal(struct zink_context *ctx) ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; } else if (ctx->dirty_gfx_stages) { /* remove old hash */ + ctx->gfx_pipeline_state.optimal_key = ctx->gfx_pipeline_state.shader_keys_optimal.key.val; ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash; update_gfx_program_optimal(ctx, ctx->curr_program); /* apply new hash */