yum-mirror/slang

Making it easier to work with shaders

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

Yong HeUse symbol alias instead of wrapper synthesis to implement link-time types. (#8603)6af3381f4

master
594 B31 linesraw
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type
2
3public interface ITest {
4    __init();
5    public int testDir(inout int a);
6};
7
8public struct TestImpl : ITest {
9    __init(){}
10    public int testDir(inout int a) {
11        int oldA = a;
12        a = 5;
13        return a;
14 }
15}
16
17//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=output
18RWStructuredBuffer<int> output;
19
20public struct Test : ITest = TestImpl;
21
22[shader("compute")]
23[numthreads(1,1,1)]
24void computeMain()
25{
26    Test data = {};
27    int a = 516;
28    int b = data.testDir(a);
29    // CHECK: 5
30    output[0] = b;
31}