From 2689056c82dde882238058d183f6455750d4e340 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 Part-of: --- src/intel/vulkan/anv_descriptor_set.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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);