VUID-VkDescriptorImageInfo-imageLayout-00344 false positive
Environment:
- OS: Windows 11
- GPU and driver version: AMD Radeon RX 6950 XT, 2.0.299
- SDK or header version if building from repo: 1.3.290.0
- Options enabled (synchronization, best practices, etc.): Image Layout
Describe the Issue
Here I have two dispatches separated by an image barrier:
The barrier looks like this:
The first dispatch writes to mip 1, the barrier transitions it from VK_IMAGE_LAYOUT_GENERAL to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, and the second dispatch reads from mip 1.
Both shaders access the mips like this:
layout(set = 0, binding = 25) uniform texture2D framebufferTextureMips[];
layout(set = 0, binding = 26, rgba16f) uniform image2D framebufferImageMips[];
Both arrays are backed by the same array of image views, each pointing to a single mip. The texture descriptors are updated with VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL and the image ones with VK_IMAGE_LAYOUT_GENERAL.
Afaik, my usage here is correct, but at the second dispatch call I get a validation error, saying that the layout of mip 1 is still VK_IMAGE_LAYOUT_GENERAL despite the barrier before the call.
Expected behavior
No validation error.
Valid Usage ID
VUID-VkDescriptorImageInfo-imageLayout-00344(ERROR / SPEC): msgNum: -564812795 - Validation Error: [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = 0x1c737122030, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2b424a0000000034, name = frameBufferImage, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xde55a405 | vkCmdDispatch(): Cannot use VkImage 0x2b424a0000000034[frameBufferImage] (layer=0 mip=1) with specific layout VK_IMAGE_LAYOUT_GENERAL that doesn't match the previous known layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. The Vulkan spec states: imageLayout must match the actual VkImageLayout of each subresource accessible from imageView at the time this descriptor is accessed as defined by the image layout matching rules (https://vulkan.lunarg.com/doc/view/1.3.290.0/windows/1.3-extensions/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)
I think this the same issue as https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/4646 and requires someone to go in and write tests and cleanup how we do layout transition tracking with miplevels