yum-mirror/slang

Making it easier to work with shaders

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

Yong HeAllow __subscript<T> syntax. (#6124)d1a13a730

master
455 B24 linesraw
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type
2
3//TEST_INPUT: set output = out ubuffer(data=[0 0 0 0], stride=4)
4RWStructuredBuffer<float> output;
5
6struct Tx
7{
8    float x;
9    __subscript<I>(I index) -> float
10        where I:IInteger
11    {
12        get { return x + index.toInt(); }
13        set { x = newValue;}
14    }
15}
16
17[numthreads(1,1,1)]
18void computeMain()
19{
20    Tx obj;
21    obj[0] = 3.0;
22    // CHECK: 5.0
23    output[0] = obj[2];
24}