KhronosGroup / KhronosGroup/Vulkan-Docs
When is it valid to use core version physical-device-level functionality?
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
(e.x. #1097.5 and #1534)
The spec says this:
> 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`.
On the face of it, it looks clear, but it leads to bit of weirdness. E.g. `vkGetPhysicalDeviceProperties2` comes from an instance extension, so originally it is an instance functionality (and enabled at instance creation), but when promoted it becomes physical-device functionality (enabled by device version).
Secondly it feels quite non-obvious and impractical to be true. The intended usage would then be:
```
vkGetPhysicalDeviceProperties( &props );
if( props.apiVersion >= 1.1 ){
vkGetPhysicalDeviceProperties2( &props2 );
}
```
It gets even weirder to use when we get to the extension structs such as `VkPhysicalDeviceVulkan11Properties`.
Additionally the problem does not seem properly caveated, and the invalid way taught. In [Vulkan-Guide](https://github.com/KhronosGroup/Vulkan-Guide/blob/5e907ef1802369ee163ec87d19dab44f15201dae/chapters/enabling_features.md) there're `vkGetPhysicalDeviceProperties2` and `VkPhysicalDeviceVulkan11Properties` but says nothing much about the prerequisites, and shows no `vkGetPhysicalDeviceProperties` initial check in the code. If we look at [Vulkan-Samples](https://github.com/KhronosGroup/Vulkan-Samples/blob/9561c55fcbc89d862d2b5265287c7b76cdf16d56/samples/extensions/raytracing_basic/raytracing_basic.cpp#L810), again I see `vkGetPhysicalDeviceProperties2` and `vkGetPhysicalDeviceFeatures2`, but no initial version check with `vkGetPhysicalDeviceProperties`.
To be reasonably practical, it feels some, if not all, physical-device-level commands should be supported by the instance version instead, and **not** the device version.
cc @Rua
Contributor guide
Assessment
This issue has not been assessed yet.