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.1 KiB43 linesraw
1// Test that StructuredBuffer of ParameterBlock (NonAddressable type) is not allowed
2
3//TEST:SIMPLE(filecheck=CHECK): -target spirv -allow-glsl -stage compute -entry computeMain
4
5// Direct ParameterBlock in StructuredBuffer - should error
6//CHECK: ([[# @LINE+1]]): error 30028
7StructuredBuffer<ParameterBlock<Texture2D>> myBuffer1;
8
9// Struct containing ParameterBlock in StructuredBuffer - should error  
10struct StructWithParameterBlock
11{
12    ParameterBlock<Texture2D> block;
13    int value;
14}
15
16//CHECK: ([[# @LINE+1]]): error 30028
17StructuredBuffer<StructWithParameterBlock> myBuffer2;
18
19// Nested struct containing ParameterBlock - should error
20struct NestedStruct
21{
22    StructWithParameterBlock nested;
23    float data;
24}
25
26//CHECK: ([[# @LINE+1]]): error 30028
27StructuredBuffer<NestedStruct> myBuffer3;
28
29// Struct containing array of ParameterBlock - should error
30struct StructWithParameterBlockArray
31{
32    ParameterBlock<Texture2D> blocks[2];
33    int value;
34}
35
36//CHECK: ([[# @LINE+1]]): error 30028
37StructuredBuffer<StructWithParameterBlockArray> myBuffer4;
38
39[numthreads(1, 1, 1)]
40void computeMain()
41{
42    // Empty - we're just testing the declarations
43}