diff --git a/src/gallium/drivers/zink/zink_program_state.hpp b/src/gallium/drivers/zink/zink_program_state.hpp index 32b808cccd4..9c3263636b7 100644 --- a/src/gallium/drivers/zink/zink_program_state.hpp +++ b/src/gallium/drivers/zink/zink_program_state.hpp @@ -211,6 +211,12 @@ zink_get_gfx_pipeline(struct zink_context *ctx, ctx->vertex_state_changed = false; const int rp_idx = state->render_pass ? 1 : 0; + if (DYNAMIC_STATE >= ZINK_DYNAMIC_VERTEX_INPUT) { + if (prog->last_finalized_hash[rp_idx][idx] == state->final_hash && !prog->inline_variants && likely(prog->last_pipeline[rp_idx][idx])) { + state->pipeline = prog->last_pipeline[rp_idx][idx]; + return state->pipeline; + } + } entry = _mesa_hash_table_search_pre_hashed(&prog->pipelines[rp_idx][idx], state->final_hash, state); if (!entry) { @@ -259,6 +265,10 @@ zink_get_gfx_pipeline(struct zink_context *ctx, struct gfx_pipeline_cache_entry *cache_entry = (struct gfx_pipeline_cache_entry *)entry->data; state->pipeline = cache_entry->pipeline; + if (DYNAMIC_STATE >= ZINK_DYNAMIC_VERTEX_INPUT) { + prog->last_finalized_hash[rp_idx][idx] = state->final_hash; + prog->last_pipeline[rp_idx][idx] = state->pipeline; + } return state->pipeline; } diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 270ac071770..e22c321fccc 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -795,6 +795,9 @@ struct zink_gfx_program { uint32_t last_variant_hash; uint8_t inline_variants; //which stages are using inlined uniforms + uint32_t last_finalized_hash[2][4]; //[dynamic, renderpass][primtype idx] + VkPipeline last_pipeline[2][4]; //[dynamic, renderpass][primtype idx] + struct set libs[4]; //zink_gfx_library_key[primtype] -> VkPipeline };