summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/struct-field-initializers/struct-field-initializer-init-inheritance-write-to-same.slang
blob: b4cb1d1c1a1b26e61a8f37dd991e15d64b97e707 (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
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain 
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -emit-spirv-directly
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-cpu -compute -entry computeMain
//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-dx12 -compute -entry computeMain

#pragma warning(disable:30816)


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

struct DefaultStructWithInit_base
{
    int data0 = 3;
    int data1 = 0;
};

struct DefaultStructWithInit : DefaultStructWithInit_base 
{
    __init()
    {
        data1 = 3;
    }
};

[numthreads(1, 1, 1)]
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
{
    DefaultStructWithInit withInit = DefaultStructWithInit();
    // BUF: 1
    outputBuffer[0] = true
        && withInit.data0 == 3
        && withInit.data1 == 3
        ;
}