yum-mirror/slang

Making it easier to work with shaders

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

kaizhangNVFeature/initialize list side branch (#6058)9ec6b9168

master
918 B42 linesraw
1//DISABLE_TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry computeMain -xslang -zero-initialize
2//DISABLE_TEST:SIMPLE(filecheck=CHECK): -target glsl -stage compute -entry computeMain -xslang -zero-initialize
3
4// CHECK-NOT: {{.* }}= 0;
5
6RWStructuredBuffer<int> outputBuffer;
7
8struct MyStruct_base
9{
10    int a = 1;
11    int b;
12};
13struct MyStruct : MyStruct_base
14{
15    int c = 1;
16    int d;
17};
18
19Array<MyStruct,2> getStructs()
20{
21    Array<MyStruct, 2> outData;
22    return outData;
23}
24
25[numthreads(1, 1, 1)]
26void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
27{
28    Array<MyStruct,2> myStruct = getStructs();
29
30// BUF: 1
31    outputBuffer[0] = true
32        && myStruct[0].a == 1
33        && myStruct[0].b == 0
34        && myStruct[0].c == 1
35        && myStruct[0].d == 0
36
37        && myStruct[1].a == 1
38        && myStruct[1].b == 0
39        && myStruct[1].c == 1
40        && myStruct[1].d == 0
41        ;
42}