From d0c8e70a64d02cd1ede15d3e8fd16829e4dcc906 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 12 Aug 2022 10:57:05 -0400 Subject: [PATCH] zink: merge compute program hash table onto program struct Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_program.c | 10 ++++------ src/gallium/drivers/zink/zink_types.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 8e83099eaf5..6122abc4d2b 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -743,8 +743,7 @@ create_compute_program(struct zink_context *ctx, nir_shader *nir) nir->info.workgroup_size[1] || nir->info.workgroup_size[2]); - comp->pipelines = _mesa_hash_table_create(NULL, NULL, - equals_compute_pipeline_state); + _mesa_hash_table_init(&comp->pipelines, comp, NULL, equals_compute_pipeline_state); memcpy(comp->base.sha1, comp->shader->base.sha1, sizeof(comp->shader->base.sha1)); @@ -938,13 +937,12 @@ zink_destroy_compute_program(struct zink_context *ctx, destroy_shader_cache(screen, &comp->shader_cache[0]); destroy_shader_cache(screen, &comp->shader_cache[1]); - hash_table_foreach(comp->pipelines, entry) { + hash_table_foreach(&comp->pipelines, entry) { struct compute_pipeline_cache_entry *pc_entry = entry->data; VKSCR(DestroyPipeline)(screen->dev, pc_entry->pipeline, NULL); free(pc_entry); } - _mesa_hash_table_destroy(comp->pipelines, NULL); VKSCR(DestroyShaderModule)(screen->dev, comp->module->shader, NULL); free(comp->module); @@ -971,7 +969,7 @@ zink_get_compute_pipeline(struct zink_screen *screen, state->pipeline = comp->base_pipeline; return state->pipeline; } - entry = _mesa_hash_table_search_pre_hashed(comp->pipelines, state->final_hash, state); + entry = _mesa_hash_table_search_pre_hashed(&comp->pipelines, state->final_hash, state); if (!entry) { util_queue_fence_wait(&comp->base.cache_fence); @@ -987,7 +985,7 @@ zink_get_compute_pipeline(struct zink_screen *screen, memcpy(&pc_entry->state, state, sizeof(*state)); pc_entry->pipeline = pipeline; - entry = _mesa_hash_table_insert_pre_hashed(comp->pipelines, state->final_hash, pc_entry, pc_entry); + 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; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index cb322de6156..8156eef5349 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -812,7 +812,7 @@ struct zink_compute_program { unsigned inlined_variant_count; struct zink_shader *shader; - struct hash_table *pipelines; + struct hash_table pipelines; VkPipeline base_pipeline; };