summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/zero-initialize/struct-array.slang
blob: 10f9aca05ed67e26863ac82a3e27a33db2b20a6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -xslang -zero-initialize
//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -emit-spirv-directly -allow-glsl -xslang -zero-initialize
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -entry computeMain -allow-glsl -xslang -zero-initialize
//DISABLE_TEST(smoke,compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-dx12 -compute -entry computeMain -allow-glsl -xslang -zero-initialize

//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

struct MyStruct_base
{
    int a;
};
struct MyStruct : MyStruct_base
{
    int b;
    int c;
};
[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
    
    Array<MyStruct, 3> myStructs;

// BUF: 1
    outputBuffer[0] = true
        && myStructs[0].a == 0
        && myStructs[0].b == 0
        && myStructs[0].c == 0

        && myStructs[1].a == 0
        && myStructs[1].b == 0
        && myStructs[1].c == 0

        && myStructs[2].a == 0
        && myStructs[2].b == 0
        && myStructs[2].c == 0
        ;
}