diff options
Diffstat (limited to 'tests/diagnostics/structuredbuffer-resource-struct-recursive-mutual.slang')
| -rw-r--r-- | tests/diagnostics/structuredbuffer-resource-struct-recursive-mutual.slang | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/diagnostics/structuredbuffer-resource-struct-recursive-mutual.slang b/tests/diagnostics/structuredbuffer-resource-struct-recursive-mutual.slang new file mode 100644 index 000000000..ac9449965 --- /dev/null +++ b/tests/diagnostics/structuredbuffer-resource-struct-recursive-mutual.slang @@ -0,0 +1,34 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv + +struct MutualB +{ + //CHECK-DAG: ([[# @LINE+1]]): error 38205 + StructuredBuffer<MutualA> aBuffer; +} + +struct MutualA +{ + //CHECK-DAG: ([[# @LINE+1]]): error 38205 + StructuredBuffer<MutualB> bBuffer; +} + +StructuredBuffer<MutualA> mutualRoot; +RWStructuredBuffer<float> output; + +// External function to force consumption of recursive types +float consumeMutual(MutualA a, MutualB b); + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint i = dispatchThreadID.x; + + float result = 0; + // Force usage of mutual recursion + MutualA a = mutualRoot[i]; + MutualB b = a.bBuffer[0]; + result += consumeMutual(a, b); + + output[i] = result; +} + |
