summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/constants/generic-const-cast.slang
blob: eb46018721719481c13258d75a03fadefca5dd9c (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
//TEST:SIMPLE(filecheck=CHECK): -entry computeMain -profile cs_5_0 -target hlsl

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

struct G<let m : uint>
{
    static const int r = m + 1;
}

// CHECK: int f_0()
// CHECK: return int(3)

int f<let n : int>(G<n> v)
{
    return v.r;
}
static const int c = (int8_t)255;

[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
    G<2> g;
    int tid = dispatchThreadID.x;
    outputBuffer[tid] = f(g);
}