yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakFix intermittent debug failures with Debug build (#7369)7dad68f86

master
1.3 KiB53 linesraw
1// This tests slangc's -dump-module command.
2// Dumping ".slang" should mean just that, and it should not automatically load up
3// a ".slang-module" when available, because the intent of the -dump-module command
4// is to see the file you requested. If there's a bug in slang-module output, it's
5// important that -dump-module looks at the specific file you requested.
6
7//TEST:COMPILE: tests/ir/dump-module.slang -o tests/ir/dump-module.slang-module -target spirv -embed-downstream-ir
8
9//TEST:SIMPLE(filecheck=CHECK1): -dump-module tests/ir/dump-module.slang-module
10//TEST:SIMPLE(filecheck=CHECK2): -dump-module tests/ir/dump-module.slang
11
12module "export-library-generics";
13
14public cbuffer Constants {
15    public float x;
16    public float y;
17}
18
19interface MyInterface
20{
21    int myMethod(int a);
22}
23
24struct MyType : MyInterface
25{
26    int myMethod(int a)
27    {
28        return a * 3;
29    }
30}
31
32int genericFunc<T: MyInterface>(T arg)
33{
34    return arg.myMethod(3);
35}
36
37public int normalFuncUsesGeneric(int a)
38{
39    MyType obj;
40    return genericFunc(obj);
41}
42
43public int normalFunc(int a, float b)
44{
45    return a - floor(b);
46}
47
48// CHECK1:EmbeddedDownstreamIR(6 : Int,
49// CHECK1:               OpCapability Linkage
50
51// CHECK2-NOT:EmbeddedDownstreamIR(6 : Int,
52// CHECK2-NOT:               OpCapability Linkage
53