Mesa (master): zink: change pipeline hashes to index based on vk primitive type

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 12 14:58:34 UTC 2020


Module: Mesa
Branch: master
Commit: ced9e6e3e5c14a0f9b7e6d20d01a337227fcf40a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ced9e6e3e5c14a0f9b7e6d20d01a337227fcf40a

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Aug 12 09:21:48 2020 -0400

zink: change pipeline hashes to index based on vk primitive type

this is a bit more convenient since we always support vk types but not
necessarily gallium types

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6269>

---

 src/gallium/drivers/zink/zink_program.c | 8 ++++----
 src/gallium/drivers/zink/zink_program.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index ef6fa7a2457..7847f1f5589 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -317,7 +317,8 @@ zink_get_gfx_pipeline(struct zink_screen *screen,
                       struct zink_gfx_pipeline_state *state,
                       enum pipe_prim_type mode)
 {
-   assert(mode <= ARRAY_SIZE(prog->pipelines));
+   VkPrimitiveTopology vkmode = primitive_topology(mode);
+   assert(vkmode <= ARRAY_SIZE(prog->pipelines));
 
    struct hash_entry *entry = NULL;
    
@@ -327,10 +328,9 @@ zink_get_gfx_pipeline(struct zink_screen *screen,
        * TODO: rework this using a separate dirty-bit */
       assert(state->hash != 0);
    }
-   entry = _mesa_hash_table_search_pre_hashed(prog->pipelines[mode], state->hash, state);
+   entry = _mesa_hash_table_search_pre_hashed(prog->pipelines[vkmode], state->hash, state);
 
    if (!entry) {
-      VkPrimitiveTopology vkmode = primitive_topology(mode);
       VkPipeline pipeline = zink_create_gfx_pipeline(screen, prog,
                                                      state, vkmode);
       if (pipeline == VK_NULL_HANDLE)
@@ -344,7 +344,7 @@ zink_get_gfx_pipeline(struct zink_screen *screen,
       pc_entry->pipeline = pipeline;
 
       assert(state->hash);
-      entry = _mesa_hash_table_insert_pre_hashed(prog->pipelines[mode], state->hash, state, pc_entry);
+      entry = _mesa_hash_table_insert_pre_hashed(prog->pipelines[vkmode], state->hash, state, pc_entry);
       assert(entry);
 
       reference_render_pass(screen, prog, state->render_pass);
diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h
index 9e7582e52c2..5e68783a2f8 100644
--- a/src/gallium/drivers/zink/zink_program.h
+++ b/src/gallium/drivers/zink/zink_program.h
@@ -51,7 +51,7 @@ struct zink_gfx_program {
    VkDescriptorSetLayout dsl;
    VkPipelineLayout layout;
    unsigned num_descriptors;
-   struct hash_table *pipelines[PIPE_PRIM_TRIANGLE_FAN + 1];
+   struct hash_table *pipelines[10]; // number of draw modes we support
    struct set *render_passes;
 };
 



More information about the mesa-commit mailing list