baldurk/renderdoc

vulkan: push constants are seemingly not captured when debugging vert/frag shaders

Closed this issue · 4 comments

Description

I am trying to debug a fragment shader in renderdoc and apparently push constants are zeroed out in the shader debugger even tho they are correctly filled when looking at the pipeline state.

Steps to reproduce

  • use vulkan
  • have graphics piepline drawing anything (I am using dynamic rendering but don't think that matters)
  • have push constants in vert/frag shader
  • select random pixel in texture viewer when vkCmdDraw is selected
  • debug pixel
  • inspect value of push constants

I am willing to provide RDC files though email on request.

Environment

  • RenderDoc version: v1.30 - 4 Dec, 2023
  • Operating System: Windows 10
  • Graphics API: Vulkan 1.3
  • Device: NVIDIA GTX 1080 ti with 546.33

Yes you should definitely share the capture because that is the most critical part of your reproduction steps. The case of shader debugging using push constants is tested nightly as part of RenderDoc's autotests and works correctly. Without the capture none of the other steps you've listed mean anything as they are very generic and apply to almost any scenario, and this is not so generally and widely broken. If you have a capture you can share I'm not sure why you wouldn't share that immediately.

I would also recommend that you run your program with the vulkan validation layers, as errors in your application may cause RenderDoc to misbehave as it does not handle invalid API use.

email has been sent, thank you for your time,
I would note that there is 0 validation errors even with sync validation turned on

Your application contains invalid use of Vulkan which causes this behaviour.

In particular you use two different pipeline layouts for the pre-rasterization shaders and fragment shaders libraries, and they do not define identical push constants, which violates VUID-VkGraphicsPipelineCreateInfo-flags-06621:

If one element of VkPipelineLibraryCreateInfoKHR::pLibraries includes VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT and another element includes VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT, push constants specified in layout in both this pipeline and the library which are available to shader stages in each must be identically defined.

VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT only applies to descriptor sets, as the name implies, push constant ranges must still be identically defined in all pipeline layouts used.

If you are not seeing an error from the validation layers on this I would first make sure you have them enabled correctly, and if you do then file an issue with the validation layers to ensure they are aware that this check is missing.

I have confirmed that this is indeed what caused the weird behaviour, sorry for the noise and thank you for your hard work on renderdoc