[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
.
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.
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
- Unzip and run the capture.
- Expand any red (draw) or blue (dispatch) debug label on the timeline, then select a draw or dispatch therein.
- Go to the pipeline state tab, then Fragment Shader or Compute Shader (whichever is appropriate).
- Click the Edit button to view the source code of the shader.
- 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.