When command buffers are no longer necessary and when they are not pending for execution on a device, they can be freed.
Freeing command buffers
How to do it...
- Take the handle of a logical device and use it to initialize a variable of type VkDevice named logical_device.
- Take the handle of a command pool created from the logical device. Store this handle in a variable of type VkCommandPool named command_pool.
- Create a vector variable with elements of type VkCommandBuffer, name the variable command_buffers. Resize the vector to be able to hold all command buffers that should be freed. Initialize the vector's elements with the handles of all the command buffers that should be freed.
- Call vkFreeCommandBuffers( logical_device, command_pool, static_cast<uint32_t...