Destroying a Vulkan Instance
After all the other resources are destroyed, we can destroy the Vulkan Instance.
How to do it...
- Take the handle of the created Vulkan Instance object stored in a variable of type
VkInstance
namedinstance
. - Call
vkDestroyInstance( instance, nullptr )
, provide theinstance
variable as the first argument and anullptr
value as the second argument. - For safety reasons, assign the
VK_NULL_HANDLE
value to theinstance
variable.
How it works...
Before we close the application, we should make sure that all the created resources are released. The Vulkan Instance is destroyed with the following code:
if( instance ) { vkDestroyInstance( instance, nullptr ); instance = VK_NULL_HANDLE; }
See also
- The recipe Creating a Vulkan Instance in this chapter