zink: fix compute shader leaks

Compute program owns the nir and zink shaders now and must free them
too when destroyed.

Fixes: 4cb4bb555e ("zink: create compute programs from compute shaders directly")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21285>
(cherry picked from commit 6af3a12e70)
This commit is contained in:
SoroushIMG 2023-02-12 00:36:29 +00:00 committed by Eric Engestrom
parent d233bf7c7d
commit 2cb4f5a1bc
2 changed files with 8 additions and 3 deletions

View file

@ -310,7 +310,7 @@
"description": "zink: fix compute shader leaks",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "4cb4bb555e702d5f8d93841a3d786400b11198fb"
},

View file

@ -1226,8 +1226,13 @@ zink_destroy_compute_program(struct zink_screen *screen,
{
deinit_program(screen, &comp->base);
if (comp->shader)
_mesa_set_remove_key(comp->shader->programs, comp);
assert(comp->shader);
assert(!comp->shader->spirv);
_mesa_set_destroy(comp->shader->programs, NULL);
ralloc_free(comp->shader->nir);
ralloc_free(comp->shader);
destroy_shader_cache(screen, &comp->shader_cache[0]);
destroy_shader_cache(screen, &comp->shader_cache[1]);