From a766d27447aa0fcf69334c0467d9b1124892e180 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 4 Sep 2025 04:05:26 +0800 Subject: Diagnose on structured buffers containing resources (#8222) closes https://github.com/shader-slang/slang/issues/3313 --- ...structuredbuffer-resource-struct-recursive.slang | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/diagnostics/structuredbuffer-resource-struct-recursive.slang (limited to 'tests/diagnostics/structuredbuffer-resource-struct-recursive.slang') diff --git a/tests/diagnostics/structuredbuffer-resource-struct-recursive.slang b/tests/diagnostics/structuredbuffer-resource-struct-recursive.slang new file mode 100644 index 000000000..ae8f916dd --- /dev/null +++ b/tests/diagnostics/structuredbuffer-resource-struct-recursive.slang @@ -0,0 +1,21 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv + +struct RecursiveFoo +{ + float value; + //CHECK-DAG: ([[# @LINE+1]]): error 38205 + StructuredBuffer children; +} + +StructuredBuffer recursiveRoot; +RWStructuredBuffer output; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint i = dispatchThreadID.x; + RecursiveFoo foo = recursiveRoot[i]; + float result = foo.value + foo.children[0].value + foo.children[0].children[0].value; + output[i] = result; +} + -- cgit v1.2.3