KhronosGroup / KhronosGroup/Vulkan-ValidationLayers
VUID-VkDescriptorImageInfo-imageLayout-00344 false positive
- Dominant language
- C++
- Stars
- 1k
- Forks
- 504
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 224
Description
**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:
```glsl
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)
Contributor guide
Research direction
Start at the vkCmdDispatch validation path for VUID-VkDescriptorImageInfo-imageLayout-00344 and trace how the image-view mip layout is tracked across the reported barrier. Reproduce the descriptor-array case described in the issue; done means the second dispatch no longer reports a layout mismatch when mip 1 was transitioned before access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100