From: Mike Blumenkrantz Date: Wed, 12 Aug 2020 13:21:48 +0000 (-0400) Subject: zink: change pipeline hashes to index based on vk primitive type X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ced9e6e3e5c14a0f9b7e6d20d01a337227fcf40a;p=mesa.git 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 Part-of: --- 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; };