summaryrefslogtreecommitdiffstats
path: root/tests/compute/assoctype-generic-arg.slang
blob: cf71d7cde88fa8411746aee255eb59f38f357b21 (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
//DISABLED_TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
//DISABLED_TEST(compute):COMPARE_COMPUTE: -shaderobj

//TEST_INPUT:type AssocImpl

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

interface IBase
{
    float getVal();
};

interface IAssoc
{
    associatedtype TBase : IBase;
};

struct BaseImpl : IBase
{
    float getVal() { return 1.0; }
};

struct AssocImpl : IAssoc
{
    typedef BaseImpl TBase;
};

[numthreads(4, 1, 1)]
void computeMain<T : IAssoc>(
    uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;
    T.TBase base;
    float rs = base.getVal();
    outputBuffer[tid] = rs;
}