Enumerating Vulkan physical devices
Before we can create a device in Vulkan, we need to select a suitable physical device, as a system may have multiple Vulkan-capable GPUs and we want to choose one with the capabilities required by our application. To do this, we need to enumerate all available physical devices on the system. This can be achieved by calling the vkEnumeratePhysicalDevices
function, which returns a list of all physical devices on the system that support the Vulkan API. Once we have the list of physical devices, we can inspect their properties and features using the vkGetPhysicalDeviceProperties
and vkGetPhysicalDeviceFeatures
functions to determine if they have the required capabilities. Finally, we can choose the most suitable physical device and use it to create a logical device through the vkCreateDevice
function.
In this recipe, you will learn how to enumerate all Vulkan-capable devices present in the system so that you can choose one that best fits your needs...