When we are done using a swapchain, because we don't want to present images any more, or because we are just closing our application, we should destroy it. We need to destroy it before we destroy a presentation surface which was used during a given swapchain creation.
Destroying a swapchain
How to do it...
- Take the handle of a logical device and store it in a variable of type VkDevice named logical_device.
- Take the handle of a swapchain object that needs to be destroyed. Store it in a variable of type VkSwapchainKHR named swapchain.
- Call vkDestroySwapchainKHR( logical_device, swapchain, nullptr ) and provide the logical_device variable as the first argument and the swapchain handle as the second argument. Set the last parameter to nullptr.
- For safety reasons...