Skip to content

Commit fda0e4e

Browse files
Firestar99fee1-dead
authored andcommitted
compiletest to showcase generic entry points
1 parent 195335a commit fda0e4e

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// build-pass
2+
// compile-flags: -C llvm-args=--disassemble
3+
// normalize-stderr-test "OpSource .*\n" -> ""
4+
// normalize-stderr-test "OpLine .*\n" -> ""
5+
// normalize-stderr-test "%\d+ = OpString .*\n" -> ""
6+
// normalize-stderr-test "(^|\n); .*" -> ""
7+
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
8+
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
9+
// ignore-spv1.0
10+
// ignore-spv1.1
11+
// ignore-spv1.2
12+
// ignore-spv1.3
13+
// ignore-vulkan1.0
14+
// ignore-vulkan1.1
15+
16+
use spirv_std::glam::*;
17+
use spirv_std::{Image, spirv};
18+
19+
#[spirv(vertex)]
20+
pub fn main<T: Copy>(in1: T, out1: &mut T) {
21+
*out1 = in1;
22+
}
23+
24+
pub fn dummy() {
25+
main::<u32>(0, &mut 0);
26+
main::<f32>(0., &mut 0.);
27+
main::<()>((), &mut ());
28+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
OpCapability Shader
3+
OpMemoryModel Logical Simple
4+
OpEntryPoint Vertex %1 "main::<f32>" %2 %3
5+
OpEntryPoint Vertex %4 "main::<u32>" %5 %6
6+
OpEntryPoint Vertex %7 "main::<()>"
7+
OpName %2 "in1"
8+
OpName %3 "out1"
9+
OpName %5 "in1"
10+
OpName %6 "out1"
11+
OpDecorate %2 Location 0
12+
OpDecorate %3 Location 0
13+
OpDecorate %5 Location 0
14+
OpDecorate %6 Location 0
15+
%9 = OpTypeFloat 32
16+
%10 = OpTypePointer Input %9
17+
%11 = OpTypePointer Output %9
18+
%12 = OpTypeVoid
19+
%13 = OpTypeFunction %12
20+
%2 = OpVariable %10 Input
21+
%3 = OpVariable %11 Output
22+
%14 = OpTypeInt 32 0
23+
%15 = OpTypePointer Input %14
24+
%16 = OpTypePointer Output %14
25+
%5 = OpVariable %15 Input
26+
%6 = OpVariable %16 Output
27+
%1 = OpFunction %12 None %13
28+
%17 = OpLabel
29+
%18 = OpLoad %9 %2
30+
OpStore %3 %18
31+
OpNoLine
32+
OpReturn
33+
OpFunctionEnd
34+
%4 = OpFunction %12 None %13
35+
%19 = OpLabel
36+
%20 = OpLoad %14 %5
37+
OpStore %6 %20
38+
OpNoLine
39+
OpReturn
40+
OpFunctionEnd
41+
%7 = OpFunction %12 None %13
42+
%21 = OpLabel
43+
OpReturn
44+
OpFunctionEnd

0 commit comments

Comments
 (0)