KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

Bug in VUID-VkDescriptorImageInfo-imageLayout-00344

Open
#4,646 12 comments 0 reactions 0 assignees View on GitHub
ImageLayout
Dominant language
C++
Stars
1k
Forks
504
Avg merge
11h 35m
Merged PRs (30d)
224

Description

**Describe the Issue**
Validation layers emit a validation error upon calling vkCmdDrawIndexed when binding a descriptor set expecting an image that is in a layout other than undefined if the barrier transitioning the image is located in another command buffer, even if these command buffers are submitted together in the correct order.

To replicate, create 2 command buffers, emit a barrier to transition an image on command buffer 1. On command buffer 2, bind a descriptor set referencing this image at its desired layout, and invoke vkCmdDrawIndexed. Submit both of these command buffers in order as the pCommandBuffers of a single VkSubmitInfo.

**Valid Usage ID**
```
VUID-VkDescriptorImageInfo-imageLayout-00344(ERROR / SPEC): msgNum: -564812795 - Validation Error: [ VUID-VkDescriptorImageInfo-imageLayout-00344 ] Object 0: handle = 0x29359b01db8, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xde55a405 | vkCmdDrawIndexed: Cannot use VkImage 0x5c59a0000000056[] (layer=0 mip=0) with specific layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL that doesn't match the previously used layout VK_IMAGE_LAYOUT_UNDEFINED. 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.224.1/windows/1.3-extensions/vkspec.html#VUID-VkDescriptorImageInfo-imageLayout-00344)
Objects: 1
[0] 0x29359b01db8, type: 6, name: NULL
[ERROR: Validation]
```

These validation errors appear for the first few frames of execution and then cease.

**Environment:**
- OS: Windows 10
- GPU: NVIDIA GeForce GTX 760
- SDK or header version if building from repo: 1.3.224.1
- Options enabled (synchronization, best practices, etc.): Validation - Standard

**Additional context**
In my personal code encountering this issue, the image emitting the error is transitioned from VK_IMAGE_LAYOUT_UNDEFINED to VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL via a render pass. It is then transitioned to the desired VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL with a pipeline barrier after executing compute shaders. After this, the image is bound in a descriptor set and used in another render pass.
If this operation is submitted to a single command buffer, there are no validation errors. If this operation is split into 2 command buffers just after the barriers, the above validation errors are emitted.
All command buffers are primary and one-time-submit.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with two primary, one-time-submit command buffers: put the image barrier in the first, then bind the descriptor and call vkCmdDrawIndexed in the second, submitting them together in order. Trace the validation handling for VUID-VkDescriptorImageInfo-imageLayout-00344 and verify that the transition is recognized across command buffers without errors in the described sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.