Destroying a presentation surface
The presentation surface represents the window of our application. It is used, among other purposes, during swapchain creation. That's why we should destroy the presentation surface after the destruction of a swapchain that is based on a given surface is finished.
How to do it...
- Prepare the handle of a Vulkan Instance and store it in a variable of type
VkInstance
namedinstance
. - Take the handle of a presentation surface and assign it to the variable of type
VkSurfaceKHR
namedpresentation_surface
. - Call
vkDestroySurfaceKHR( instance, presentation_surface, nullptr )
and provide theinstance
andpresentation_surface
variables in the first two parameters and anullptr
value in the last parameter. - For safety reasons, assign a
VK_NULL_HANDLE
value to thepresentation_surface
variable.
How it works...
The presentation surface's destruction is very similar to the destruction of other Vulkan resources presented so far. We make sure we don't provide a VK_NULL_HANDLE
value...