Initializing the Vulkan instance
To start using Vulkan, we need to create a Vulkan instance. One can think of a Vulkan instance as a way of initializing the Vulkan library. To create one, you need to provide a set of required and optional information such as application name, engine name, version, and a list of desired layers and extensions.
In this recipe, you will learn how to create a Vulkan instance.
Getting ready
Instantiating the VkApplicationInfo
structure used to create an instance requires the version of the application and the Vulkan API version. The former can be created using the VK_MAKE_VERSION
macro, while the latter can be provided as one of the preprocessor definitions available in the SDK.
How to do it…
With all of those in hand, all we need to do is create a Vulkan instance:
- Create an instance of the
VkApplicationInfo
structure first:const VkApplicationInfo applicationInfo_ = { .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO...