After all the other resources are destroyed, we can destroy the Vulkan Instance.
Destroying a Vulkan Instance
How to do it...
- Take the handle of the created Vulkan Instance object stored in a variable of type VkInstance named instance.
- Call vkDestroyInstance( instance, nullptr ), provide the instance variable as the first argument and a nullptr value as the second argument.
- For safety reasons, assign the VK_NULL_HANDLE value to the instance 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