KhronosGroup / KhronosGroup/Vulkan-ValidationLayers
Use of `VkApplicationInfo::apiVersion` to limit available enums/structs in (physical) device calls
- Dominant language
- C++
- Stars
- 1k
- Forks
- 504
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 224
Description
**Describe the situation in which you encountered the missing validation**
I'm not exactly confident from reading https://docs.vulkan.org/spec/latest/chapters/initialization.html#VkApplicationInfo that `apiVersion` here describes/limits the "API" that we can use. From reading https://docs.vulkan.org/spec/latest/chapters/fundamentals.html#fundamentals-validusage-enums it doesn't seem to constrain what I can pass to `vkCreateDevice()` for example:
> - If the enumerant is used in a function that has a [`VkPhysicalDevice`](https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html#VkPhysicalDevice) object as its first parameter and either:
> - it was added by a core version that is supported by that device (as reported by [`VkPhysicalDeviceProperties`](https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html#VkPhysicalDeviceProperties)::`apiVersion`);
But if we move on to https://docs.vulkan.org/spec/latest/chapters/initialization.html#_extending_physical_device_core_functionality, it says:
> New core physical-device-level functionality can be used when **both** [`VkPhysicalDeviceProperties`](https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html#VkPhysicalDeviceProperties)::apiVersion **and [`VkApplicationInfo`](https://docs.vulkan.org/spec/latest/chapters/initialization.html#VkApplicationInfo)::`apiVersion`** are greater than or equal to the version of Vulkan that added the new functionality.
Emphasis mine. If that's true, validation is probably expected here?
In my example I find a Vulkan 1.4 physical device while only setting `VkApplicationInfo::apiVersion` to 1.2, and expected a validation layer error for using/passing structures to `vkCreateDevice()` that are only defined in 1.3 onwards, such as passing `VkPhysicalDeviceVulkan13Features` (my application shouldn't be allowed to assume that anything from a core version `>1.2` even exists?).
**Valid Usage IDs requested**
Please include the valid usage IDs for the checks you are requesting:
?
**Additional Context**
Perhaps this is alson an upstream Vulkan-Docs issue, as the last quote should probably make its way into the earlier two if this is true.
### Prior art
- https://github.com/KhronosGroup/Vulkan-Docs/issues/1097 point 4.
- https://github.com/KhronosGroup/Vulkan-Docs/issues/1539
- https://github.com/KhronosGroup/Vulkan-Docs/issues/1569
- https://github.com/KhronosGroup/Vulkan-Docs/issues/2077 point 6. (there is a reply that says "yea I missed that this is bounded by the api version - will fix." but not sure it materialized)
- https://github.com/KhronosGroup/Vulkan-Docs/issues/2384
Contributor guide
Research direction
Start by comparing the Vulkan initialization, fundamentals valid-usage, and extending physical-device core functionality sections cited in the issue. Reproduce the vkCreateDevice case using VkPhysicalDeviceVulkan13Features with VkApplicationInfo::apiVersion set to 1.2, then determine the required validation rule and valid usage ID; done means the inappropriate use is reported consistently or the specification ambiguity is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100