mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-12 17:40:32 +01:00
zink: fix separate shader program refcounting
this fixes the refcount for the separate shader program to not have a leaked ref
and then fixes the owned program to have the expected number of refs
this happened to work some of the time before because there was an arbitrary unref
in replace_separable_prog(), but this shouldn't have been necessary
Fixes: e3b746e3a3 ("zink: use GPL to handle (simple) separate shader objects")
fixes #9274
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23888>
This commit is contained in:
parent
84bb6078f4
commit
4e38061643
1 changed files with 3 additions and 2 deletions
|
|
@ -705,7 +705,6 @@ replace_separable_prog(struct zink_screen *screen, struct hash_entry *entry, str
|
|||
real->base.removed = false;
|
||||
prog->full_prog = NULL;
|
||||
prog->base.removed = true;
|
||||
zink_gfx_program_reference(screen, &prog, NULL);
|
||||
return real;
|
||||
}
|
||||
|
||||
|
|
@ -1155,6 +1154,8 @@ 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);
|
||||
/* add an ownership ref */
|
||||
zink_gfx_program_reference(zink_screen(prog->ctx->base.screen), NULL, prog->full_prog);
|
||||
precompile_job(prog->full_prog, gdata, thread_index);
|
||||
}
|
||||
|
||||
|
|
@ -1223,7 +1224,7 @@ create_gfx_program_separable(struct zink_context *ctx, struct zink_shader **stag
|
|||
/* We can do this add after the _mesa_set_adds above because we know the prog->shaders[] are
|
||||
* referenced by the draw state and zink_gfx_shader_free() can't be called on them while we're in here.
|
||||
*/
|
||||
p_atomic_add(&prog->base.reference.count, refs);
|
||||
p_atomic_add(&prog->base.reference.count, refs - 1);
|
||||
|
||||
for (int r = 0; r < ARRAY_SIZE(prog->pipelines); ++r) {
|
||||
for (int i = 0; i < ARRAY_SIZE(prog->pipelines[0]); ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue