summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/inheritance/struct-inheritance-import.slang
blob: 218d4d09d193136a2f13448346745f9a7482c0d1 (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
// struct-inheritance-import.slang

//TEST(compute):COMPARE_COMPUTE:

// This test confirms that the synthesized code for struct type inheritance
// includes proper linkage decorations so that it can work across modules.

import struct_inheritance_imported;

int test(int val)
{
    Derived d;
    d.a = val;

    return 0x100 + d.a*0x10 + getA(d);
}

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

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;
    int inVal = int(tid);
    int outVal = test(inVal);
    outputBuffer[tid] = outVal;
}