summaryrefslogtreecommitdiffstats
path: root/tests/compute/global-type-param.slang
blob: 6ec957d9d539c73777d45ab8cc11b55656b5cac3 (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
35
36
37
38
//DISABLED_TEST(smoke,compute):COMPARE_COMPUTE: -shaderobj

//TEST_INPUT:type Wrapper<Impl>

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

interface IBase
{
    float compute();
}

struct Wrapper<T : IBase> : IBase
{
    T obj;
    float compute()
    {
        return obj.compute();        
    }
};

struct Impl : IBase
{
    float compute()
    {
        return 1.0;
    }
};

[numthreads(1, 1, 1)]
void computeMain<TImpl:IBase>(
    uniform TImpl impl,
    uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;
	float outVal = impl.compute();
	outputBuffer[tid] = outVal;
}