anv: destroy sets when destroying pool

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14169
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
(cherry picked from commit 2689056c82)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38167>
This commit is contained in:
Lionel Landwerlin 2025-10-23 20:08:45 +03:00 committed by Dylan Baker
parent 159d397437
commit a9653fa019
2 changed files with 13 additions and 2 deletions

View file

@ -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

View file

@ -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);