zink: add gfx pipeline lookup shortcut
if the final hash was the same as the last-used hash for this program, it should be safe to reuse the last pipeline object in the presence of dynamic vertex input since the number of permutations is low Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
This commit is contained in:

committed by
Marge Bot

parent
6a836eaff5
commit
1d521a5c15
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user