If we want to return memory allocated by a descriptor set and give it back to the pool, we can free a given descriptor set.
Freeing descriptor sets
How to do it...
- Use the handle of a logical device to initialize a variable of type VkDevice named logical_device.
- Take the descriptor pool that was created with a VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT flag. Store its handle in a variable of type VkDescriptorPool named descriptor_pool.
- Create a vector of type std::vector<VkDescriptorSet> named descriptor_sets. Add all the descriptor sets that should be freed to the vector.
- Call vkFreeDescriptorSets( logical_device, descriptor_pool, static_cast<uint32_t>(descriptor_sets.size()), descriptor_sets.data() ). For the call provide the logical_device...