KhronosGroup / Vulkan-Docs

The Vulkan API Specification and related tools
Other
2.82k stars 469 forks source link

Physical-Device-Level function valid usage for Newer Core Versions #2384

Closed FuXiii closed 4 months ago

FuXiii commented 5 months ago

image The Physical-device-level functionality valid Usage describe maybe need add Extending Physical Device Core Functionality link as a supplement.

The Extending Physical Device Core Functionality:

image

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.

Pseudocode may looks like:

vk_pfn_SomeOnePhysicalDeviceFunction* sopdf = ...;

//If we have a function can get the Vulkan function release version
uint32_t sopdf_release_version = GetPhysicalDeviceFunctionReleaseVulkanVersion(sopdf);

if(VkPhysicalDeviceProperties::apiVersion >= sopdf_release_version && VkApplicationInfo::apiVersion >= sopdf_release_version)
{
    sopdf(...);//Can just use it
}

New core physical-device-level functionality can be used when the physical-device version is greater than or equal to the version of Vulkan that added the new functionality. The Vulkan version supported by a physical device can be obtained by calling vkGetPhysicalDeviceProperties.

Pseudocode may looks like:

vk_pfn_SomeOnePhysicalDeviceFunction* sopdf = ...;

//If we have a function can get the Vulkan function release version
uint32_t sopdf_release_version = GetPhysicalDeviceFunctionReleaseVulkanVersion(sopdf);

if(VkPhysicalDeviceProperties::apiVersion >= sopdf_release_version)
{
    sopdf(...);//Can just use it
}

According to the Extending Physical Device Core Functionality standards, there seems to be ambiguity with Valid Usage for Newer Core Versions

r-potter commented 4 months ago

@FuXiii In a recent version of the spec, we changed "Extending Physical Device Core Functionality" to say this:

image

There shouldn't be any ambiguity now. Both sections say that you have to check VkPhysicalDeviceProperties::apiVersion and have supplied a high enough value for VkApplicationInfo::apiVersion. The only thing that the "Extending Physical Device Core Functionality" section adds beyond that is explanatory text suggesting calling vkGetPhysicalDeviceProperties, so there doesn't seem much value in linking between the two sections.

If we've missed something else, then I'm happy to address it, but I think we have already made the change requested here

FuXiii commented 4 months ago

Ok, fixed it perfect! Thanks! :)