google/amber

Use Vulkan application, instance, and device versions accurately

Opened this issue · 1 comments

The Vulkan API version at various points is more complex than it might seem intuitively. There is not just one number we need to check.

(Edited to add VkPhysicalDevice version and use tables.)

To use core functionality:

Functionality type Must be supported by the...
Instance-level Instance version
Physical-device-level Physical device version
Device-level Physical device version

To use extension functionality:

Functionality type Must be supported by the...
Instance-level (from an instance extension) The instance (vkEnumerateInstanceExtensionProperties)
Physical-device-level (from an instance extension) The instance (vkEnumerateInstanceExtensionProperties)
Physical-device-level (from a device extension) The physical device. Requires both the instance and physical device versions to be at least 1.1, or the `VK_KHR_get_physical_device_properties2` extension. Then the app calls `vkEnumerateDeviceExtensionProperties(VkPhysicalDevice, ...)` to enumerate the device extension for the physical device, then uses `vkGetInstanceProcAddr` to get function pointers (where the functions are from one of the enumerated device extensions and have a first arg of type VkPhysicalDevice).
Device-level (from a device extension) The physical device (vkEnumerateDeviceExtensionProperties)

From the Vulkan spec, section 3.7.2:

Valid Usage for Newer Core Versions

Instance-level functionality or behavior added by a new core version of the API must not be used
unless it is supported by the instance as determined by vkEnumerateInstanceVersion and the
specified version of VkApplicationInfo::apiVersion.

Physical-device-level functionality or behavior added by a new core version of the API must not be
used unless it is supported by the physical device as determined by VkPhysicalDeviceProperties
::apiVersion and the specified version of VkApplicationInfo::apiVersion.

Device-level functionality or behavior added by a new core version of the API must not be used
unless it is supported by the device as determined by VkPhysicalDeviceProperties::apiVersion and
the specified version of VkApplicationInfo::apiVersion.

END QUOTE.

See: https://old.reddit.com/r/vulkan/comments/9i2me9/new_to_vulkan_what_happens_if_api_versions_are/

See Vulkan spec section: 39.2.2. Querying Version Support

See: https://github.com/KhronosGroup/Vulkan-Guide/blob/master/chapters/versions.md

See: https://stackoverflow.com/a/65382710