From 867f6cb90c7d3ccd79d5eb0c67537a83ae964dd2 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 22 Jul 2015 17:33:09 -0700 Subject: [PATCH] vk: Add a FreeDescriptorSets function --- include/vulkan/vulkan.h | 7 +++++++ src/vulkan/anv_device.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index a9f55a4927d..8af58d15a27 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -2168,6 +2168,7 @@ typedef VkResult (VKAPI *PFN_vkCreateDescriptorPool)(VkDevice device, VkDescript typedef VkResult (VKAPI *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool); typedef VkResult (VKAPI *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool); typedef VkResult (VKAPI *PFN_vkAllocDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount); +typedef VkResult (VKAPI *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets); typedef VkResult (VKAPI *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies); typedef VkResult (VKAPI *PFN_vkCreateDynamicViewportState)(VkDevice device, const VkDynamicViewportStateCreateInfo* pCreateInfo, VkDynamicViewportState* pState); typedef VkResult (VKAPI *PFN_vkDestroyDynamicViewportState)(VkDevice device, VkDynamicViewportState dynamicViewportState); @@ -2671,6 +2672,12 @@ VkResult VKAPI vkAllocDescriptorSets( VkDescriptorSet* pDescriptorSets, uint32_t* pCount); +VkResult VKAPI vkFreeDescriptorSets( + VkDevice device, + VkDescriptorPool descriptorPool, + uint32_t count, + const VkDescriptorSet* pDescriptorSets); + VkResult VKAPI vkUpdateDescriptorSets( VkDevice device, uint32_t writeCount, diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index 1847303a1cb..22abddc0cd6 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1820,6 +1820,23 @@ VkResult anv_AllocDescriptorSets( return VK_SUCCESS; } +VkResult anv_FreeDescriptorSets( + VkDevice _device, + VkDescriptorPool descriptorPool, + uint32_t count, + const VkDescriptorSet* pDescriptorSets) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + + for (uint32_t i = 0; i < count; i++) { + ANV_FROM_HANDLE(anv_descriptor_set, set, pDescriptorSets[i]); + + anv_descriptor_set_destroy(device, set); + } + + return VK_SUCCESS; +} + VkResult anv_UpdateDescriptorSets( VkDevice device, uint32_t writeCount, -- 2.30.2