zink: change pipeline hashes to index based on vk primitive type
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 12 Aug 2020 13:21:48 +0000 (09:21 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 12 Aug 2020 14:52:26 +0000 (14:52 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6269>

src/gallium/drivers/zink/zink_program.c
src/gallium/drivers/zink/zink_program.h

index ef6fa7a24576a86a30611278c324a982760e6e60..7847f1f5589f10cad04ee6c0d7e4b689a5176bed 100644 (file)
@@ -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);
index 9e7582e52c2fafee4ac9dc2368e19d79392b96bc..5e68783a2f80177ea6d36c3db90194c8e4d93174 100644 (file)
@@ -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;
 };