KhronosGroup / Vulkan-Docs

The Vulkan API Specification and related tools
Other
2.72k stars 453 forks source link

VUID-VkDeviceImageMemoryRequirements-pCreateInfo-06420 issues #2309

Open Rua opened 5 months ago

Rua commented 5 months ago

VUID-VkDeviceImageMemoryRequirements-pCreateInfo-06420 currently states:

If pCreateInfo->tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then planeAspect must be a single valid memory plane for the image (that is, aspectMask must specify a plane index that is less than the VkDrmFormatModifierPropertiesEXT::drmFormatModifierPlaneCount associated with the image’s format and VkImageDrmFormatModifierPropertiesEXT::drmFormatModifier

This VUID seems to have been copied more or less directly from VUID-VkImagePlaneMemoryRequirementsInfo-planeAspect-02282, but in the context of VkDeviceImageMemoryRequirements there's some issues with it.

First, unlike VUID 02282, VUID 06420 applies to all DRM format modifier images, regardless of whether they are disjoint or not. For a non-disjoint image, all planes share a single memory binding, so it does not make any sense to query the memory requirements for a specific plane. This VUID should apply only to disjoint images, and for non-disjoint images, VkDeviceImageMemoryRequirements::planeAspect should be ignored.

Secondly, VUID 06420 applies at a time when the image object has not yet been created. The DRM format modifier is not known until after image creation, and the user cannot query the VkImageDrmFormatModifierPropertiesEXT until then. Only the list of potential DRM format modifiers is known, via the VkImageDrmFormatModifierListCreateInfoEXT structure in the pNext chain. This also means that there are multiple potential values for drmFormatModifierPlaneCount, and it's not clear which one the planeAspects value should be compared against.

ShabbyX commented 4 months ago

FYI @versalinyaa

oddhack commented 4 months ago

Assigned to @versalinyaa for triage.