From 96df31a9fa53e3d897a2b7c4eef021f37f421c91 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Mon, 13 Oct 2025 23:14:45 +0900 Subject: Fix segfault on arrays of structs containing parameter blocks (#8555) Closes https://github.com/shader-slang/slang/issues/8154 However there is further design work to do on implementing the "NonAddressableType" suggestion --- .../diagnostics/array-parameterblock-nested.slang | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/diagnostics/array-parameterblock-nested.slang (limited to 'tests/diagnostics/array-parameterblock-nested.slang') diff --git a/tests/diagnostics/array-parameterblock-nested.slang b/tests/diagnostics/array-parameterblock-nested.slang new file mode 100644 index 000000000..f2c30ea88 --- /dev/null +++ b/tests/diagnostics/array-parameterblock-nested.slang @@ -0,0 +1,26 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): + +// Test: Array of nested struct containing ParameterBlock - should error + +struct Inner +{ + ParameterBlock pb; +} + +struct NestedStruct +{ + Inner nested; + float value; +} + +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + // Force usage of the array to prevent optimization + outputBuffer[dispatchThreadID.x] = arrayOfNestedStruct[dispatchThreadID.x % 2].nested.pb; +} + +//CHECK: ([[# @LINE+1]]): error 30027 +uniform NestedStruct arrayOfNestedStruct[2]; \ No newline at end of file -- cgit v1.2.3