When a buffer is no longer used, we should destroy it.
Destroying a buffer
How to do it...
- Take the handle of a logical device and store it in a variable of type VkDevice named logical_device.
- Store the buffer's handle in a variable of type VkBuffer named buffer.
- Call vkDestroyBuffer( logical_device, buffer, nullptr ) and provide the handle of the logical device, the handle of the buffer, and a nullptr value.
- For safety reasons, assign the VK_NULL_HANDLE value to the buffer variable.
How it works...
Buffers are destroyed using the vkDestroyBuffer() function like this:
if( VK_NULL_HANDLE != buffer ) { vkDestroyBuffer...