summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/structured-buffer-parameterblock.slang
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-10-13 23:14:45 +0900
committerGitHub <noreply@github.com>2025-10-13 22:14:45 +0800
commit96df31a9fa53e3d897a2b7c4eef021f37f421c91 (patch)
tree46cfb983265ce63b619da3b18004d2c163371d2c /tests/diagnostics/structured-buffer-parameterblock.slang
parentf5a3a6dc6a98d22964154f809f9e0dcae30ab67f (diff)
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
Diffstat (limited to 'tests/diagnostics/structured-buffer-parameterblock.slang')
-rw-r--r--tests/diagnostics/structured-buffer-parameterblock.slang43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/diagnostics/structured-buffer-parameterblock.slang b/tests/diagnostics/structured-buffer-parameterblock.slang
new file mode 100644
index 000000000..1fd2b52c8
--- /dev/null
+++ b/tests/diagnostics/structured-buffer-parameterblock.slang
@@ -0,0 +1,43 @@
+// Test that StructuredBuffer of ParameterBlock (NonAddressable type) is not allowed
+
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -allow-glsl -stage compute -entry computeMain
+
+// Direct ParameterBlock in StructuredBuffer - should error
+//CHECK: ([[# @LINE+1]]): error 30028
+StructuredBuffer<ParameterBlock<Texture2D>> myBuffer1;
+
+// Struct containing ParameterBlock in StructuredBuffer - should error
+struct StructWithParameterBlock
+{
+ ParameterBlock<Texture2D> block;
+ int value;
+}
+
+//CHECK: ([[# @LINE+1]]): error 30028
+StructuredBuffer<StructWithParameterBlock> myBuffer2;
+
+// Nested struct containing ParameterBlock - should error
+struct NestedStruct
+{
+ StructWithParameterBlock nested;
+ float data;
+}
+
+//CHECK: ([[# @LINE+1]]): error 30028
+StructuredBuffer<NestedStruct> myBuffer3;
+
+// Struct containing array of ParameterBlock - should error
+struct StructWithParameterBlockArray
+{
+ ParameterBlock<Texture2D> blocks[2];
+ int value;
+}
+
+//CHECK: ([[# @LINE+1]]): error 30028
+StructuredBuffer<StructWithParameterBlockArray> myBuffer4;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ // Empty - we're just testing the declarations
+} \ No newline at end of file