summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/modules/wrapper-inout.slang
blob: ec42c917783b86f7623f4213179eae1bed014ab1 (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
//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type

public interface ITest {
    __init();
    public int testDir(inout int a);
};

public struct TestImpl : ITest {
    __init(){}
    public int testDir(inout int a) {
        int oldA = a;
        a = 5;
        return a;
 }
}

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

public struct Test : ITest = TestImpl;

[shader("compute")]
[numthreads(1,1,1)]
void computeMain()
{
    Test data = {};
    int a = 516;
    int b = data.testDir(a);
    // CHECK: 5
    output[0] = b;
}