From 0624130933e609f41cd618fcff7b3100fc5c24cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Thu, 4 Apr 2024 12:37:41 +0200 Subject: [PATCH] zink: Remove ctx from zink_gfx_program MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is already available in the base structure. Signed-off-by: Corentin Noël Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 6 +++--- src/gallium/drivers/zink/zink_program.c | 6 ++---- src/gallium/drivers/zink/zink_types.h | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index be907c181b7..26943c69027 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -5830,13 +5830,13 @@ zink_gfx_shader_free(struct zink_screen *screen, struct zink_shader *shader) unsigned idx = zink_program_cache_stages(stages_present); if (!prog->base.removed && prog->stages_present == prog->stages_remaining && (stage == MESA_SHADER_FRAGMENT || !shader->non_fs.is_generated)) { - struct hash_table *ht = &prog->ctx->program_cache[idx]; - simple_mtx_lock(&prog->ctx->program_lock[idx]); + struct hash_table *ht = &prog->base.ctx->program_cache[idx]; + simple_mtx_lock(&prog->base.ctx->program_lock[idx]); struct hash_entry *he = _mesa_hash_table_search(ht, prog->shaders); assert(he && he->data == prog); _mesa_hash_table_remove(ht, he); prog->base.removed = true; - simple_mtx_unlock(&prog->ctx->program_lock[idx]); + simple_mtx_unlock(&prog->base.ctx->program_lock[idx]); util_queue_fence_wait(&prog->base.cache_fence); for (unsigned r = 0; r < ARRAY_SIZE(prog->pipelines); r++) { diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 4106181d49d..69aaf1aba72 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -1073,7 +1073,6 @@ zink_create_gfx_program(struct zink_context *ctx, if (!prog) goto fail; - prog->ctx = ctx; prog->gfx_hash = gfx_hash; prog->base.removed = true; prog->optimal_keys = screen->optimal_keys; @@ -1168,9 +1167,9 @@ static void create_linked_separable_job(void *data, void *gdata, int thread_index) { struct zink_gfx_program *prog = data; - prog->full_prog = zink_create_gfx_program(prog->ctx, prog->shaders, 0, prog->gfx_hash); + prog->full_prog = zink_create_gfx_program(prog->base.ctx, prog->shaders, 0, prog->gfx_hash); /* add an ownership ref */ - zink_gfx_program_reference(zink_screen(prog->ctx->base.screen), NULL, prog->full_prog); + zink_gfx_program_reference(zink_screen(prog->base.ctx->base.screen), NULL, prog->full_prog); precompile_job(prog->full_prog, gdata, thread_index); } @@ -1200,7 +1199,6 @@ create_gfx_program_separable(struct zink_context *ctx, struct zink_shader **stag if (!prog) goto fail; - prog->ctx = ctx; prog->is_separable = true; prog->gfx_hash = ctx->gfx_hash; prog->base.uses_shobj = screen->info.have_EXT_shader_object; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 3b0bff1a5c4..3ac77d19b48 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1111,7 +1111,6 @@ struct zink_gfx_program { struct zink_program base; bool is_separable; //not a full program - struct zink_context *ctx; //the owner context uint32_t stages_present; //mask of stages present in this program uint32_t stages_remaining; //mask of zink_shader remaining in this program