summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2023-06-27 12:54:47 -0400
committerEric Engestrom <eric@engestrom.ch>2023-07-15 22:49:58 +0100
commit29d3034e446e2d1c667f4f6f1a4c5f8730cf95b2 (patch)
tree8f8632aa9dedd4bae67d301d43d74393517dd7f1 /src
parent99f9fa03781a2cdf08bd884a04230da33266c3f3 (diff)
downloadmesa-29d3034e446e2d1c667f4f6f1a4c5f8730cf95b2.tar.gz
mesa-29d3034e446e2d1c667f4f6f1a4c5f8730cf95b2.tar.bz2
mesa-29d3034e446e2d1c667f4f6f1a4c5f8730cf95b2.zip
zink: do initial program unref during program creation
this ensures that programs are never created with more than $num_shaders refs, which is otherwise not necessarily a bug but can lead to bugs Fixes: a0e69e7601a ("zink: split out first-time shader module creation") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23888> (cherry picked from commit 84bb6078f44a8518bd7080ae2362ae1a8a6383c8)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/zink/zink_program.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 22dc33beb62..9393ba667f5 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -437,7 +437,6 @@ generate_gfx_program_modules(struct zink_context *ctx, struct zink_screen *scree
variant_hash ^= prog->module_hash[i];
}
- p_atomic_dec(&prog->base.reference.count);
state->modules_changed = true;
prog->last_variant_hash = variant_hash;
@@ -459,7 +458,6 @@ generate_gfx_program_modules_optimal(struct zink_context *ctx, struct zink_scree
prog->modules[i] = zm->shader;
}
- p_atomic_dec(&prog->base.reference.count);
state->modules_changed = true;
prog->last_variant_hash = state->shader_keys_optimal.key.val;
}
@@ -1095,6 +1093,7 @@ zink_create_gfx_program(struct zink_context *ctx,
}
}
_mesa_sha1_final(&sctx, prog->base.sha1);
+ p_atomic_dec(&prog->base.reference.count);
if (!zink_descriptor_program_init(ctx, &prog->base))
goto fail;