Since functions are used to interact with the loader and implementations, there needs to be a little more care when working between minor versions. As an example, let’s look at vkGetPhysicalDeviceFeatures2KHR
which was promoted to core as vkGetPhysicalDeviceFeatures2
from Vulkan 1.0 to Vulkan 1.1. Looking at the Vulkan header both are declared.
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures);
// ...
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures);
The main difference is when calling vkGetInstanceProcAddr(instance, “vkGetPhysicalDeviceFeatures2”);
a Vulkan 1.0 implementation may not be aware of vkGetPhysicalDeviceFeatures2
existence and vkGetInstanceProcAddr
will return NULL
. To be backward compatible with Vulkan 1.0 in this situation, the application should query for vkGetPhysicalDeviceFeatures2KHR
as a 1.1 Vulkan implementation will likely have the function directly pointed to the vkGetPhysicalDeviceFeatures2
function pointer internally.
Note | The vkGetPhysicalDeviceFeatures2KHR function will only exist in a Vulkan 1.0 implementation if it is supported as an extension. |