From 3e9a108c782c0eeeea5943f357497b5829d2fddb Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 12 Aug 2022 10:49:07 -0400 Subject: [PATCH] zink: add a pipeline shortcut for basic compute programs if there are no inline uniforms, nonseamless cubes, or local size use, then this is the "base" pipeline object that can be reused without checking the hash table Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_program.c | 6 ++++++ src/gallium/drivers/zink/zink_types.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index cb0b7b73ff0..8e83099eaf5 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -967,6 +967,10 @@ zink_get_compute_pipeline(struct zink_screen *screen, state->dirty = false; state->final_hash ^= state->hash; } + if (!comp->use_local_size && !comp->curr->num_uniforms && !comp->curr->has_nonseamless && comp->base_pipeline) { + state->pipeline = comp->base_pipeline; + return state->pipeline; + } entry = _mesa_hash_table_search_pre_hashed(comp->pipelines, state->final_hash, state); if (!entry) { @@ -985,6 +989,8 @@ zink_get_compute_pipeline(struct zink_screen *screen, entry = _mesa_hash_table_insert_pre_hashed(comp->pipelines, state->final_hash, pc_entry, pc_entry); assert(entry); + if (!comp->use_local_size && !comp->curr->num_uniforms && !comp->curr->has_nonseamless) + comp->base_pipeline = pipeline; } struct compute_pipeline_cache_entry *cache_entry = entry->data; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 1d53b5351e9..cb322de6156 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -813,6 +813,8 @@ struct zink_compute_program { struct zink_shader *shader; struct hash_table *pipelines; + + VkPipeline base_pipeline; };