summaryrefslogtreecommitdiffstats
path: root/tests/compute/simple-interface-parameter.slang
blob: 7b1ab76a41b958467e5254f64f6d3fbfb2a1f5f3 (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
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
//TEST(compute):COMPARE_COMPUTE_EX:-slang -cuda -compute

interface IGetter
{
    int get(int x);
}

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

//TEST_INPUT: globalSpecializationArg MyGetter
//TEST_INPUT: set gGetter = new MyGetter{}
uniform IGetter gGetter;

[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
    gOutputBuffer[dispatchThreadID.x] = gGetter.get(dispatchThreadID.x);
}

struct MyGetter : IGetter
{
    int get(int x)
    {
        return x + 1;
    }
}