nvk: Unref shaders on pipeline free

Fixes: d6a1e29ccd ("nvk: pipeline shader cache")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27130>
(cherry picked from commit be0f04f5bd)
This commit is contained in:
Faith Ekstrand 2024-01-17 12:06:22 -06:00 committed by Eric Engestrom
parent ed75400a50
commit 2ff9219359
2 changed files with 6 additions and 1 deletions

View file

@ -94,7 +94,7 @@
"description": "nvk: Unref shaders on pipeline free",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "d6a1e29ccdc12461495e01b7dc0b510a9bb84c3d",
"notes": null

View file

@ -32,6 +32,11 @@ nvk_pipeline_free(struct nvk_device *dev,
struct nvk_pipeline *pipeline,
const VkAllocationCallbacks *pAllocator)
{
for (uint32_t s = 0; s < ARRAY_SIZE(pipeline->shaders); s++) {
if (pipeline->shaders[s] != NULL)
vk_pipeline_cache_object_unref(&dev->vk, &pipeline->shaders[s]->base);
}
vk_object_free(&dev->vk, pAllocator, pipeline);
}