From a9653fa019fc7a6daff1a8c8f32aa714a4dbc5cf Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 23 Oct 2025 20:08:45 +0300 Subject: [PATCH] anv: destroy sets when destroying pool Signed-off-by: Lionel Landwerlin Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14169 Reviewed-by: Ivan Briano (cherry picked from commit 2689056c82dde882238058d183f6455750d4e340) Part-of: --- .pick_status.json | 2 +- src/intel/vulkan/anv_descriptor_set.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 0899f0395ba..62c83dc031d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -484,7 +484,7 @@ "description": "anv: destroy sets when destroying pool", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index 801111ce520..c65d506502b 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -1387,6 +1387,10 @@ VkResult anv_CreateDescriptorPool( return VK_SUCCESS; } +static void anv_descriptor_set_destroy(struct anv_device *device, + struct anv_descriptor_pool *pool, + struct anv_descriptor_set *set); + void anv_DestroyDescriptorPool( VkDevice _device, VkDescriptorPool _pool, @@ -1400,9 +1404,16 @@ void anv_DestroyDescriptorPool( ANV_RMV(resource_destroy, device, pool); + /* From the Vulkan spec, vkDestroyDescriptorPool: + * + * "When a pool is destroyed, all descriptor sets allocated from the + * pool are implicitly freed and become invalid. Descriptor sets + * allocated from a given pool do not need to be freed before destroying + * that descriptor pool." + */ list_for_each_entry_safe(struct anv_descriptor_set, set, &pool->desc_sets, pool_link) { - vk_descriptor_set_layout_unref(&device->vk, &set->layout->vk); + anv_descriptor_set_destroy(device, pool, set); } util_vma_heap_finish(&pool->host_heap);