Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when VkExternalImageFormatProperties is present without VkPhysicalDeviceExternalImageFormatInfo #2462

Open
MarijnS95 opened this issue Nov 12, 2024 · 2 comments
Assignees

Comments

@MarijnS95
Copy link
Contributor

MarijnS95 commented Nov 12, 2024

Describe the situation in which you encountered the missing validation

When having VkExternalImageFormatProperties in VkImageFormatProperties2
and calling vkGetPhysicalDeviceImageFormatProperties2(), all its fields remain uninitialized.

When reading the description of the contained VkExternalMemoryProperties structure more closely, the handleType referenced in the # Members section above appears to refer to VkPhysicalDeviceExternalImageFormatInfo: it turns out this struct must be extending VkPhysicalDeviceImageFormatInfo2 and set to the specific handle type one wishes to import or export before its features and compatibility with other handle types are exposed.

In short, I expected a VUID to be raised when VkExternalImageFormatProperties is in the pNext chain of VkImageFormatProperties2 without having VkPhysicalDeviceExternalImageFormatInfo in the pNext chain of VkPhysicalDeviceImageFormatInfo2 while calling vkGetPhysicalDeviceImageFormatProperties2().
(while this becomes obvious when reading the documentation properly, too-quickly skimming it lead at least me to believe that VkExternalMemoryProperties::compatibleHandleTypes was going to be filled with all the handle types that the image might be imported/exported as...)

Perhaps such validation is not possible because of the following mention in VkPhysicalDeviceExternalImageFormatInfo's description:

If handleType is 0, vkGetPhysicalDeviceImageFormatProperties2 will behave as if VkPhysicalDeviceExternalImageFormatInfo was not present, and VkExternalImageFormatProperties will be ignored.

I.e. it is expected to be silently ignored (😞) when the struct is missing or its handleType set to 0?

Valid Usage IDs requested
There doesn't seem to be a VUID for this yet, because of the "will be ignored" clause above?

Additional context
Perhaps the documentation would have been easier to read if mentions of handleType were actually linking through to VkPhysicalDeviceExternalImageFormatInfo::handleType, and perhaps this struct should be mentioned in the # Name section or # C Specification, i.e. extending:

VkExternalMemoryProperties - Structure specifying external memory handle type capabilities

To something like:

VkExternalMemoryProperties - Structure specifying external memory handle type capabilities for an external handle specified in/by stype:VkPhysicalDeviceExternalImageFormatInfo

After all VkPhysicalDeviceExternalImageFormatInfo mentions VkExternalImageFormatProperties (but the link is broken?), there's just no obvious link in reverse.


And maybe the surrounding VkExternalImageFormatProperties should mention the same?

@spencer-lunarg spencer-lunarg self-assigned this Nov 12, 2024
@spencer-lunarg spencer-lunarg transferred this issue from KhronosGroup/Vulkan-ValidationLayers Nov 12, 2024
@spencer-lunarg
Copy link

In short, I expected a VUID to be raised when VkExternalImageFormatProperties is in the pNext chain of VkImageFormatProperties2 without having VkPhysicalDeviceExternalImageFormatInfo in the pNext chain of VkPhysicalDeviceImageFormatInfo2 while calling vkGetPhysicalDeviceImageFormatProperties2().

@cubanismo can you take a look at this. Happy to try write a VUID, but want to confirm if this an oversight or working as expected

@MarijnS95
Copy link
Contributor Author

@spencer-lunarg to reconfirm, it seems to be "working as expected" given the exception I quoted from https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceExternalImageFormatInfo.html#_description:

If handleType is 0, vkGetPhysicalDeviceImageFormatProperties2 will behave as if VkPhysicalDeviceExternalImageFormatInfo was not present, and VkExternalImageFormatProperties will be ignored.

That just seems to be counter intuitive.

Also note that will behave as if VkPhysicalDeviceExternalImageFormatInfo was not present does not appear to be explicitly defined anywhere except in the same quote, where it continues to sayand VkExternalImageFormatProperties will be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants