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