Resetting a descriptor pool
We can free all descriptor sets allocated from a given pool at once without destroying the pool itself. To do that, we can reset a descriptor pool.
How to do it...
- Take the descriptor pool that should be reset and use its handle to initialize a variable of type
VkDescriptorPool
nameddescriptor_pool
. - Take the handle of a logical device on which the descriptor pool was created. Store its handle in a variable of type
VkDevice
namedlogical_device
.
- Make the following call:
vkResetDescriptorPool( logical_device, descriptor_pool, 0 )
, for which use thelogical_device
anddescriptor_pool
variables and a0
value. - Check for any error returned by the call. As successful operation should return
VK_SUCCESS
.
How it works...
Resetting a descriptor pool returns all the descriptor sets allocated from it back to the pool. All descriptor sets allocated from the pool are implicitly freed and they can't be used any more (their handles become invalid).
If the pool is created without a VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT...