Vulkan-ValidationLayers icon indicating copy to clipboard operation
Vulkan-ValidationLayers copied to clipboard

Use real command, not vkCmdDraw for queue submission checks

Open StefanPoelloth opened this issue 8 months ago • 3 comments

Environment:

  • OS: Win11
  • GPU and driver version: RTX 5080 driver 576.28
  • SDK or header version if building from repo: SDK 1.4.313.2
  • Options enabled (synchronization, best practices, etc.): Core -> Image Layout, GPU-AV -> Image Layout, GPU-AV -> Postprocess descriptor indexing

Describe the Issue

see comment below - https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/10318#issuecomment-3029901242

validation layer: [ Debug region: TempBuildHzbPass ] vkQueueSubmit(): pSubmits[0].pSubmits[0].pSubmits[0].pSubmits[0].pSubmits[0].pSubmits[0] command buffer VkCommandBuffer 0x24bb86d6020[Frame 1] expects VkImage 0x2730000000273[IblPrefilterPass image] (subresource: aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, mipLevel = 0, arrayLayer = 0) to be in layout VK_IMAGE_LAYOUT_GENERAL--instead, current layout is VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. (Detected from GPU-AV). The Vulkan spec states: If a descriptor with type equal to any of VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM, VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT is accessed as a result of this command, all image subresources identified by that descriptor must be in the image layout identified when the descriptor was written (https://vulkan.lunarg.com/doc/view/1.4.313.2/windows/antora/spec/latest/chapters/drawing.html#VUID-vkCmdDraw-None-09600) `

  • The url is wrong. vkCmdDraw isnt used at all in the codebase. We use CmdDrawMeshTasksIndirect and CmdDrawMeshTasksIndirectCount. so if the error message isnt a false positive it could be https://registry.khronos.org/vulkan/specs/latest/man/html/vkCmdDrawMeshTasksIndirectCountEXT.html#VUID-vkCmdDrawMeshTasksIndirectCountEXT-None-09600
  • The debug region is wrong, that debug region is completely unrelated to the VkImage
  • What is pSubmits[0].pSubmits[0].pSubmits[0].pSubmits[0].pSubmits[0].pSubmits[0] ?
  • The error message is incorrect: First the image cubemap is created once in a computer shader (general layout) in one commandbuffer and then only sampled in fragment and compute shaders in the following commandbuffers. So it doesnt make sense that it complains about being in shader readonly. The synchronisation and layouts were manually inspected to be correct.

This message only appreas if the three VVL option above are enabled.

Additional context

Image

StefanPoelloth avatar Jun 26 '25 10:06 StefanPoelloth

few things going on

  1. We have decided to remove GPU-AV Image Layout check (https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/10161) as it was turned off by default, had almost zero testing, and just not something we want to have as it clearly has many false positives
  2. the pSubmit[0].pSubmit[0]... issue was fixed here https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/10163
  3. The "The url is wrong. vkCmdDraw isnt used at all in the codebase." is a known issue, we are still working on a way to encode "which" draw time the shader observed to return a better error message

spencer-lunarg avatar Jun 26 '25 12:06 spencer-lunarg

The url is wrong. vkCmdDraw isnt used at all in the codebase.

Yes, can confirm because looked at this recently (it's not only in gpu-av). We have TODO in the code. One option is not to print any command at all, because it is submit time validation and only print QueueSubmit type of command (which is available) and then say that in submitted command the first used image layout for this image subresource is this one, but current global image layout is different. I guess it should also be possible to provide specific command that specified image layout for this image the first time in the command buffer which then used in comparison logic against global/current image layout.

artem-lunarg avatar Jun 26 '25 12:06 artem-lunarg

updated title, 1 and 2 i mentioned are not an issue anymore, but agree the vCmdDraw being these is still very much a "needs to be fixed"

spencer-lunarg avatar Jul 03 '25 00:07 spencer-lunarg