yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie HermaszewskaFix segfault on arrays of structs containing parameter blocks (#8555)96df31a9f

master
1.3 KiB46 linesraw
1// Test that unbounded arrays are NonAddressable and cannot be used in arrays
2
3//TEST:SIMPLE(filecheck=CHECK): -target spirv -allow-glsl -stage compute -entry computeMain
4
5// Unbounded array itself is fine
6int unboundedArray[];
7
8// Array of unbounded arrays - should error (unbounded arrays are NonAddressable)
9//CHECK: ([[# @LINE+1]]): error 30027
10int arrayOfUnbounded[3][];
11
12// Struct containing unbounded array (must be last member)
13struct StructWithUnbounded
14{
15    float value;
16    int data[];  // Unbounded array must be last member
17}
18
19// Array of struct containing unbounded array - should error (struct is NonAddressable)
20//CHECK: ([[# @LINE+1]]): error 30027
21StructWithUnbounded myArray[2];
22
23// StructuredBuffer of struct with unbounded array - should error
24//CHECK: ([[# @LINE+1]]): error 30028
25StructuredBuffer<StructWithUnbounded> myBuffer;
26
27// Nested case
28struct NestedUnbounded
29{
30    int id;
31    StructWithUnbounded nested;  // Struct with unbounded array member
32}
33
34// Array of nested struct - should error
35//CHECK: ([[# @LINE+1]]): error 30027
36NestedUnbounded nestedArray[5];
37
38// StructuredBuffer of nested struct - should error
39//CHECK: ([[# @LINE+1]]): error 30028
40StructuredBuffer<NestedUnbounded> nestedBuffer;
41
42[numthreads(1, 1, 1)]
43void computeMain()
44{
45    // Empty - we're just testing the declarations
46}