Skip to content

anv: Improve image/view usage bits verification

Sviatoslav Peleshko requested to merge GL/mesa:usage_checks_fixes into main

This change makes usage bits verification closer to the Vulkan spec (at least as I understand it).

VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT does not always require all formats to support all the requested usage bits. There is nothing about such strict checking in the spec, and other drivers don't seem to do it as strictly. This change fixes #6031 (closed), as it checks that it can create VK_FORMAT_B8G8R8A8_UNORM/VK_FORMAT_B8G8R8A8_SRGB image with VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT, but VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT is not supported for VK_FORMAT_B8G8R8A8_SRGB at all. I've also tried to check if this validation is a consequence of some internal driver requirements, but found nothing to confirm it. Even with this commit CI run seem to pass (with the exception of one test in the group that seem to fail randomly), and the gamescope with usage described above also works. So I don't think that strict validation must be there. CC @chadversary as the author of the original check, maybe there's something I'm really missing.

v2: Per chadversary's suggestion, the loop checking if the given possible view formats support each usage bit was removed, as the verification of that really seems more like an app's job rather than driver's

v3: Added back verification of the list removed in v2. Added verification of all compatible formats when the list is not given.

Signed-off-by: Sviatoslav Peleshko sviatoslav.peleshko@globallogic.com

Edited by Sviatoslav Peleshko

Merge request reports