yum-mirror/slang

Making it easier to work with shaders

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

Yong HeSupport visibility control and default to `internal`. (#3380)11111e573

master
530 B36 linesraw
1//TEST:EXECUTABLE:
2__target_intrinsic(cpp, "printf(\"%s\\n\", ($0).getBuffer())")
3void writeln(String text);
4
5[COM("BE18F5D2-4522-4AB0-A6EE-1D157FA2B083")]
6interface IFoo
7{
8    int method();
9};
10
11class Impl : IFoo
12{
13    __init() { }
14    int method()
15    {
16        return 0;
17    }
18}
19
20void createFoo(out IFoo val)
21{
22    Impl resuult = new Impl();
23    val = resuult;
24}
25
26export __extern_cpp int main()
27{
28    IFoo v;
29    createFoo(v);
30
31    if (v.method() == 0)
32        writeln("succ");
33    else
34        writeln("fail");
35    return 0;
36}