Resetting a command pool
When we don't want to reset command buffers individually, or if we created a pool without a VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
flag, we can reset all command buffers allocated from a given pool at once.
How to do it...
- Take the handle of a logical device and store it in a variable of type
VkDevice
namedlogical_device
. - Take the handle of a created command pool. Use it to initialize a variable of type
VkCommandPool
namedcommand_pool
. - Create a variable of type
VkCommandPoolResetFlags
namedrelease_resources
and initialize it with a value ofVK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT
, if memory reserved by all command buffers allocated from the command pool should be released and returned to the pool, or with a0
value otherwise. - Call
vkResetCommandPool( logical_device, command_pool, release_resources )
and provide thelogical_device
,command_pool
andrelease_resources
variables. - Make sure the call returned a
VK_SUCCESS
value, which indicates it was successful...