microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] Local resource arrays of RWStructuredBuffer fail to compile
Open
Nobody has claimed this yet.
bug
spirv
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Cannot create local resource array from RWStructuredBuffer objects.
Steps to Reproduce
RWStructuredBuffer<int> X : register(u0);
RWStructuredBuffer<int> Y : register(u1);
void SomeFn(RWStructuredBuffer<int> B[2], uint Idx, int Val0) {
B[0] = Y;
B[0][Idx] = Val0;
}
[numthreads(4,1,1)]
void main(uint GI : SV_GroupIndex) {
RWStructuredBuffer<int> A[2] = {X, Y};
SomeFn(A, GI, 1);
A[0][GI] = 2;
}
Actual Behavior
<source>:11:34: error: Cannot cast initializer type 'RWStructuredBuffer<int>' into variable type 'RWStructuredBuffer<int> [2]'
RWStructuredBuffer<int> A[2] = {X, Y};
^
<source>:11:34: fatal error: cannot find the associated counter variable
Environment
- DXC version: All, up to trunk.
- Host Operating System: All
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the HLSL example in the issue through the linked Compiler Explorer setup and confirm the reported diagnostics for local RWStructuredBuffer arrays. No repository file or test is named, so trace the compiler's SPIR-V handling for this construct and add coverage showing that the declaration, function argument, and indexed accesses compile successfully.
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
- Mostly clear
- Newbie friendliness
- 35/100