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 --- .../array-parameterblock-array-in-struct.slang | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/diagnostics/array-parameterblock-array-in-struct.slang (limited to 'tests/diagnostics/array-parameterblock-array-in-struct.slang') diff --git a/tests/diagnostics/array-parameterblock-array-in-struct.slang b/tests/diagnostics/array-parameterblock-array-in-struct.slang new file mode 100644 index 000000000..832c90925 --- /dev/null +++ b/tests/diagnostics/array-parameterblock-array-in-struct.slang @@ -0,0 +1,22 @@ +// Test that structs containing arrays of ParameterBlocks are also NonAddressable +// and therefore cannot be used in arrays + +//TEST:SIMPLE(filecheck=CHECK): -target spirv -allow-glsl -stage compute -entry computeMain +//TEST_DISABLED:SIMPLE(filecheck=CHECK): -target glsl -allow-glsl -stage compute -entry computeMain + +// Test case: struct containing array of ParameterBlock +struct StructWithParameterBlockArray +{ + ParameterBlock blocks[2]; // Array of ParameterBlocks + int value; +} + +// This should trigger error 30027 - arrays of NonAddressable types are not allowed +//CHECK: ([[# @LINE+1]]): error 30027 +StructWithParameterBlockArray myArray[3]; // Array of struct containing ParameterBlock array + +[numthreads(1, 1, 1)] +void computeMain() +{ + // Empty - we're just testing the declaration +} \ No newline at end of file -- cgit v1.2.3