KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

False positive image layout mismatch for VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT descriptors

Open
#1,519 10 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

I have a typical image layout mismatch error *"cannot use VkImage with specific layout X that doesn't match the previous known layout Y"*.

It could be a bug related to delayed descriptors validation due to UPDATE_AFTER_BIND flag and more specifically how **CMD_BUFFER_STATE::validate_descriptorsets_in_queuesubmit** state is used in this scenario. I'm not 100% sure though. Please check the pseudocode for use case that causes the issue, the comments explain what happens:

```
create DescriptorSet with VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT image binding
create Image/ImageView

vkUpdateDescriptorSets(DescriptorSet, ImageView+layoutX)
vkCmdPipelineBarrier(cb, transition Image to layoutX)
vkCmdBindDescriptorsSes(cb, 0, DescriptorSet)
vkCmdBindPipeline(cb, Pipeline)

//
// here validation layer will insert DescriptorSet into validate_descriptorsets_in_queuesubmit
//
vkCmdDispatch(cb, 1,1,1)

vkCmdPipelineBarrier(cb, transition Image to layoutY)

//
// CoreChecks::ValidateCommandBuffersForSubmit will go over descriptor sets in
// validate_descriptorsets_in_queuesubmit and will check if current image layout (layoutY)
// matches layout specified in the descriptor (layoutX) which is not the case and the error
// is reported, even though image layout state was correct during dispatch.
//
vkQueueSubmit(cb)
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing CMD_BUFFER_STATE::validate_descriptorsets_in_queuesubmit and CoreChecks::ValidateCommandBuffersForSubmit using the pseudocode in the issue. Reproduce the descriptor update, dispatch, later image transition, and queue submission sequence, then verify that validation no longer reports a layout mismatch when the image layout was correct during dispatch.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.