yum-mirror/slang

Making it easier to work with shaders

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

skallweitNVenable more metal tests (#4326)712ce653d

master
687 B34 linesraw
1// simple-inline.slang
2
3//TEST(compute):COMPARE_COMPUTE: -shaderobj
4//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj
5//DISABLE_TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
6
7[ForceInline]
8int test(int r)
9{
10    return r+2;
11}
12
13[ForceInline]
14void testVoid(int r, out int result)
15{
16    if (r == 0)
17    {
18        result = 2;
19        return;
20    }
21    result = r + 3;
22}
23
24//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
25RWStructuredBuffer<int> outputBuffer;
26
27[numthreads(1, 1, 1)]
28void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
29{
30    outputBuffer[0] = test(dispatchThreadID.x);
31    int rs;
32    testVoid(dispatchThreadID.x + 2, rs);
33    outputBuffer[1] = rs;
34}