zink: Remove ctx from zink_gfx_program

It is already available in the base structure.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28567>
This commit is contained in:
Corentin Noël 2024-04-04 12:37:41 +02:00 committed by Marge Bot
parent b0d680f54c
commit 0624130933
3 changed files with 5 additions and 8 deletions

View File

@ -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++) {

View File

@ -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;

View File

@ -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