KhronosGroup / KhronosGroup/glslang

HLSL: UAV counters always in descriptor set 0

Open
#1,100 6 comments 0 reactions 0 assignees View on GitHub
bug HLSL
Dominant language
C++
Stars
3.6k
Forks
990
Avg merge
1d 2h
Merged PRs (30d)
31

Description

It looks like glslang always puts the UAV counters in ```DescriptorSet 0```. @danginsburg and I chatted about this briefly and were wondering if they should remain in the same descriptor set as their respective UAV buffers.

Sample shader compiled with ```--amb```:
```C
struct Data {
float4 v;
};
ConsumeStructuredBuffer buf_in : register(u0, space1);
AppendStructuredBuffer buf_out : register(u2, space3);

float4 main(float4 sv_pos : SV_POSITION) : SV_TARGET
{
Data val = buf_in.Consume();
buf_out.Append(val);
return sv_pos;
}
````

...produces...
````
Decorate 18(buf_in) BufferBlock
Decorate 20(buf_in) DescriptorSet 1
Decorate 20(buf_in) Binding 0
MemberDecorate 23(buf_in@count) 0 Offset 0
Decorate 23(buf_in@count) BufferBlock
Decorate 25(buf_in@count) DescriptorSet 0
Decorate 25(buf_in@count) Binding 0
Decorate 39(buf_out) DescriptorSet 3
Decorate 39(buf_out) Binding 2
Decorate 40(buf_out@count) DescriptorSet 0
Decorate 40(buf_out@count) Binding 1
````

```buf_in@count``` and ```buf_out@count``` are both in ```DescriptorSet 0``` while ```buf_in``` and ```buf_out``` are in ```DescriptorSet 2``` and ```DescriptorSet 3```, respectively.

Contributor guide

Open the contributing guide

Research direction

Start by compiling the provided HLSL sample with the mentioned --amb option and inspect the generated descriptor-set decorations for buf_in@count and buf_out@count. Done means establishing and implementing the correct descriptor-set relationship between each UAV counter and its corresponding UAV buffer, then confirming the sample output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.