April 2017
Intermediate to advanced
700 pages
21h 36m
English
To destroy a swapchain, we can prepare code that is similar to the following example:
if( swapchain ) {
vkDestroySwapchainKHR( logical_device, swapchain, nullptr );
swapchain = VK_NULL_HANDLE;
}
First we check whether a swapchain was really created (if its handle is not empty). Next we call the vkDestroySwapchainKHR() function and then we assign a VK_NULL_HANDLE value to the swapchain variable to be sure that we won't try to delete the same object twice.
Read now
Unlock full access