KhronosGroup / Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
https://vulkan.lunarg.com/doc/sdk/latest/linux/khronos_validation_layer.html
Other
755 stars 403 forks source link

VUID-vkCmdDraw-None-08114 false positive #8315

Open Trider12 opened 2 months ago

Trider12 commented 2 months ago

Environment:

Describe the Issue

I have a descriptor set S with binding 3 flagged with VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT. This is a single descriptor binding. Compute pipeline A uses binding 3, I wait for the fence and destroy the resources behind that binding. After that compute pipeline B uses set S, but does not touch binding 3 at all. Still, after submitting B's dispatch I get this:

Validation Error: [ VUID-vkCmdDraw-None-08114 ] Object 0: handle = 0x5c5283000000003e, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0x2ba3a98e | vkCmdDraw(): the descriptor (VkDescriptorSet 0x5c5283000000003e[], binding 3, index 0) is using imageView VkImageView 0x8168780000000092[] that is invalid or has been destroyed. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid as described by descriptor validity if they are statically used by the VkPipeline bound to the pipeline bind point used by this command and the bound VkPipeline was not created with VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdDraw-None-08114)

In fact, I get the same error with or without using VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT. From the spec:

VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT indicates that descriptors in this binding that are not dynamically used need not contain valid descriptors at the time the descriptors are consumed. A descriptor is dynamically used if any shader invocation executes an instruction that performs any memory access using the descriptor. If a descriptor is not dynamically used, any resource referenced by the descriptor is not considered to be referenced during command execution.

It seems that the layers do not respect this flag (when the binding has only a single descriptor?) and issue an error. Here's the line where the error is logged.

Additionally, when validating the descriptors, the type of command is hardcoded to vkCmdDraw here, which causes more confusion.

Additionally, this use case caused the layers to sometimes crash on this line (likely due to dereferencing a stale pointer) in version 1.3.280.0, but this seems to be fixed in 1.3.290.0.

Expected behavior

VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT should be respected and the error message should reference the correct command.

spencer-lunarg commented 2 months ago

friendly update on this - we are currently spending a LOT of energy trying to improve all things related to descriptor indexing and GPU-AV ... this will hopefully be addressed as conscience of that effort, but thanks for reporting this!