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
879 B50 linesraw
1// shader.slang
2
3// Example of using 'NativeString'
4
5export __extern_cpp NativeString getString(NativeString in)
6{
7    return in;
8}
9
10export __extern_cpp __global int intGlobal = 10;
11
12export __extern_cpp void setGlobal(int v)
13{
14    intGlobal = v;
15}
16
17export __extern_cpp int getGlobal()
18{
19    return intGlobal;
20}
21
22[COM("9E0FCAF0-DE40-4CF1-A6A4-FF24814D32F2")]
23interface IDoThings
24{
25    int doThing(int a, int b);
26    int calcHash(NativeString in);
27}
28
29[COM("4CEA3168-819E-4E79-987B-8C4FDE6C697D")]
30interface ICountGood
31{
32    int nextCount();
33}
34
35export __extern_cpp __global ICountGood globalCounter;
36
37export __extern_cpp void setCounter(ICountGood counter)
38{
39    globalCounter = counter;
40}
41
42export __extern_cpp int nextCount()
43{
44    return globalCounter.nextCount();
45}
46
47export __extern_cpp int calcHash(NativeString text, IDoThings doThings)
48{
49    return doThings.calcHash(text);
50}