summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-6964.slang
blob: b283a17a8a9b718de8fb15d27c0f630a18450f58 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -dx12
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu

// CHECK: 1
// CHECK-NEXT: 0
// CHECK-NEXT: 2
// CHECK-NEXT: 3

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

interface IThing
{
    void writeInfo(int i);
}

enum FirstEnum
{
    A,
    B
};

enum SecondEnum
{
    C,
    D=3
};

extension FirstEnum: IThing
{
    void writeInfo(int i)
    {
        outputBuffer[i] = 1;
        outputBuffer[i+1] = this;
    }
}

extension SecondEnum: IThing
{
    void writeInfo(int i)
    {
        outputBuffer[i] = 2;
        outputBuffer[i+1] = this;
    }
}

void indirectionFunc<T: IThing>(T val, int i)
{
    val.writeInfo(i);
}

[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
    indirectionFunc(FirstEnum.A, 0);
    indirectionFunc(SecondEnum.D, 2);
}