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

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

public struct TestImpl : ITest {
    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;
}