summaryrefslogtreecommitdiff
path: root/tests/language-feature/generics/generic-overload.slang
blob: a5ce3ae8f6a3a56e1aeafb669bb79319bc35d149 (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
//TEST(compute):SIMPLE(filecheck=CHECK_EXPLICIT): -target spirv-asm -entry computeMain -stage compute -DEXPLICIT
//TEST(compute):SIMPLE(filecheck=CHECK_OVERLOAD): -target spirv-asm -entry computeMain -stage compute -DOVERLOAD

enum CoopMatMatrixLayout
{
    RowMajor = 0,
    ColumnMajor = 1,
};

int Load<let me : CoopMatMatrixLayout>(int inVal)
{
    return int(inVal % 10);
}

#if !defined(EXPLICIT)
int Load<let Dim : uint, let ClampMode : uint>(int inVal, int inVal2)
{
    return Load<CoopMatMatrixLayout.RowMajor>(inVal);
}
#endif

[Shader("compute")]
[NumThreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
    int tid = dispatchThreadID.x;

#if defined(EXPLICIT)
    //CHECK_EXPLICIT: error 30019: expected an expression of type 'CoopMatMatrixLayout', got 'int'
    //CHECK_EXPLICIT: note: explicit conversion from 'int' to 'CoopMatMatrixLayout' is possible
    int outVal = Load<0>(tid);

#elif defined(OVERLOAD)
    //CHECK_OVERLOAD-NOT: error {{[1-9][0-9]*}}
    int outVal = Load<CoopMatMatrixLayout.RowMajor>(tid);
#endif
}