summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/simple-inline.slang
blob: 8203f489b7536445c103a439256e04ab444dd649 (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
// simple-inline.slang

//TEST(compute):COMPARE_COMPUTE: -shaderobj
//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj
//DISABLE_TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj

[ForceInline]
int test(int r)
{
    return r+2;
}

[ForceInline]
void testVoid(int r, out int result)
{
    if (r == 0)
    {
        result = 2;
        return;
    }
    result = r + 3;
}

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

[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
    outputBuffer[0] = test(dispatchThreadID.x);
    int rs;
    testVoid(dispatchThreadID.x + 2, rs);
    outputBuffer[1] = rs;
}