yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeFix generic param inference through TypeCastIntVal. (#2916)c3c1b56ae

master
534 B26 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -entry computeMain -profile cs_5_0 -target hlsl
2
3//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
4RWStructuredBuffer<int> outputBuffer;
5
6struct G<let m : uint>
7{
8    static const int r = m + 1;
9}
10
11// CHECK: int f_0()
12// CHECK: return int(3)
13
14int f<let n : int>(G<n> v)
15{
16    return v.r;
17}
18static const int c = (int8_t)255;
19
20[numthreads(1, 1, 1)]
21void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
22{
23    G<2> g;
24    int tid = dispatchThreadID.x;
25    outputBuffer[tid] = f(g);
26}