yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie HermaszewskaDiagnose on structured buffers containing resources (#8222)a766d2744

master
752 B34 linesraw
1//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv
2
3struct MutualB
4{
5    //CHECK-DAG: ([[# @LINE+1]]): error 38205
6    StructuredBuffer<MutualA> aBuffer;
7}
8
9struct MutualA
10{
11    //CHECK-DAG: ([[# @LINE+1]]): error 38205
12    StructuredBuffer<MutualB> bBuffer;
13}
14
15StructuredBuffer<MutualA> mutualRoot;
16RWStructuredBuffer<float> output;
17
18// External function to force consumption of recursive types
19float consumeMutual(MutualA a, MutualB b);
20
21[numthreads(4, 1, 1)]
22void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
23{
24    uint i = dispatchThreadID.x;
25
26    float result = 0;
27    // Force usage of mutual recursion
28    MutualA a = mutualRoot[i];
29    MutualB b = a.bBuffer[0];
30    result += consumeMutual(a, b);
31
32    output[i] = result;
33}
34