baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.

Home Page:https://renderdoc.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Vulkan] Pipeline state only shows one declaration per aliased binding

JuanDiegoMontoya opened this issue · comments

Description

I am making a bindless renderer in Vulkan using large array descriptors and descriptor indexing. With this, a GLSL shader that uses multiple storage buffers may declare their blocks like so (notice that they share a binding):

layout(set = 0, binding = 0) buffer FooBinding {
  Foo foo;
}fooBuffers[];

layout(set = 0, binding = 0) buffer BarBinding {
  Bar bar;
}barBuffers[];

Then, I access the buffers via indices passed via push constants:

Foo foo = fooBuffers[pushConstants.fooBufferIndex];
Bar bar = barBuffers[pushConstants.barBufferIndex];

The problem is that, when I select a draw or dispatch containing this code in RenderDoc, the pipeline state tab only shows one of these declarations.

For a real example, consider this GLSL code where I declare two buffer block array bindings:

layout(set = 0, binding = 0, std430) restrict readonly buffer ExposureBuffer
{
    float exposure;
} exposureBuffers[];

layout(set = 0, binding = 0, std430) restrict readonly buffer TonemapUniformBuffer
{
    float saturation;
    float agxDsLinearSection;
    float peak;
    float compression;
    uint enableDithering;
} uniformsBuffers[];

Both blocks contribute to an output of the shader. When we examine this dispatch in the pipeline state tab, notice how exposureBuffers appears, but not uniformsBuffers.
image

RenderDoc can determine which resources are dynamically accessed. The resources with italicized text are unused in this dispatch. But, as you'd expect, it makes no sense to interpret anything but Exposure (buffer) through this declaration. To view the data in Tonemap Uniforms (buffer), I have to manually input a format with which to interpret the buffer data.
image
Ideally, all resource/block declarations that share a binding should appear independently and only display resources that are dynamically accessed through that declaration.

Steps to reproduce

bug.zip

  1. Unzip and run the capture.
  2. Expand any red (draw) or blue (dispatch) debug label on the timeline, then select a draw or dispatch therein.
  3. Go to the pipeline state tab, then Fragment Shader or Compute Shader (whichever is appropriate).
  4. Click the Edit button to view the source code of the shader.
  5. Compare the number of declarations of a particular resource type in the shader to that shown in the pipeline state tab.

Environment

  • RenderDoc version: v1.31
  • OS: Windows 10 22H2, build 19045.4046
  • Graphics API: Vulkan
  • GPU: RTX 3070
  • Driver version: 551.61

This has been fixed with a recent refactor to how descriptors are handled. The feedback on bindless usage can now report which binding triggered the access so aliased bindings like this will be reported accurately.

I built the latest commit (943d11d at the time of writing) on the default branch and can confirm that it's fixed now. Thanks!

Note for readers: it's not fixed in the recently-released v1.32. You'll have to build from source or wait for another release.