yum-mirror/slang

Making it easier to work with shaders

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

Yong HeInitial support for immutable lambda expressions. (#6914)7f1df9d0b

master
469 B20 linesraw
1
2//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type
3//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
4
5//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
6RWStructuredBuffer<float> outputBuffer;
7
8IFunc<float, float> createFunc(int c)
9{
10    return (float x) => (float)(x * 2 + c);
11}
12
13
14[numthreads(1, 1, 1)]
15void computeMain()
16{
17    let func = createFunc(2);
18    // CHECK: 8.0
19    outputBuffer[0] = func(3.0);
20}