yum-mirror/slang

Making it easier to work with shaders

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

Yong HeImplement explciit binding for metal and wgsl. (#5778)7dabfa76c

master
544 B33 linesraw
1// static-method.slang
2
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
4
5struct S
6{
7    static void doThing(in out int x, int y)
8    {
9        x += y;
10    }
11}
12
13//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
14RWStructuredBuffer<int> outputBuffer;
15
16int test(int t)
17{
18    S::doThing(t, 0x10);
19
20    (S::doThing(t, 0x200));
21
22    (S::doThing)(t, 0x4000);
23
24    return t;
25}
26
27[numthreads(4)]
28void computeMain(int3 tid : SV_DispatchThreadID)
29{
30    int val = tid.x;
31    val = test(val);
32    outputBuffer[tid.x] = val;
33}