File tree Expand file tree Collapse file tree 2 files changed +97
-0
lines changed
tests/compiletests/ui/glam Expand file tree Collapse file tree 2 files changed +97
-0
lines changed Original file line number Diff line number Diff line change
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
+ // ignore-vulkan1.0
8
+ // ignore-vulkan1.1
9
+
10
+ use spirv_std:: arch:: subgroup_shuffle_up;
11
+ use spirv_std:: spirv;
12
+
13
+ #[ repr( C ) ]
14
+ #[ derive( Copy , Clone , Default ) ]
15
+ #[ rust_gpu:: vector:: v1]
16
+ pub struct Vec3 {
17
+ x : f32 ,
18
+ y : f32 ,
19
+ z : f32 ,
20
+ }
21
+
22
+ #[ repr( C , align( 16 ) ) ]
23
+ #[ derive( Copy , Clone , Default ) ]
24
+ #[ rust_gpu:: vector:: v1]
25
+ pub struct Vec3A {
26
+ x : f32 ,
27
+ y : f32 ,
28
+ z : f32 ,
29
+ }
30
+
31
+ #[ repr( C ) ]
32
+ #[ derive( Copy , Clone , Default ) ]
33
+ pub struct Data < T > {
34
+ t : T ,
35
+ // this should generate two distinct structs where this member has different offsets
36
+ value : f32 ,
37
+ }
38
+
39
+ impl Vec3 {
40
+ pub fn to_vec3a ( & self ) -> Vec3A {
41
+ Vec3A {
42
+ x : self . x ,
43
+ y : self . y ,
44
+ z : self . z ,
45
+ }
46
+ }
47
+ }
48
+
49
+ #[ spirv( fragment) ]
50
+ pub fn main ( input : Data < Vec3 > , output : & mut Data < Vec3A > ) {
51
+ * output = Data {
52
+ t : input. t . to_vec3a ( ) ,
53
+ value : input. value ,
54
+ } ;
55
+ }
Original file line number Diff line number Diff line change
1
+ OpCapability Shader
2
+ OpCapability VulkanMemoryModel
3
+ OpMemoryModel Logical Vulkan
4
+ OpEntryPoint Fragment %1 "main" %2 %3
5
+ OpExecutionMode %1 OriginUpperLeft
6
+ OpName %5 "Data<Vec3>"
7
+ OpMemberName %5 0 "t"
8
+ OpMemberName %5 1 "value"
9
+ OpName %6 "Data<Vec3A>"
10
+ OpMemberName %6 0 "t"
11
+ OpMemberName %6 1 "value"
12
+ OpName %2 "input"
13
+ OpName %3 "output"
14
+ OpMemberDecorate %5 0 Offset 0
15
+ OpMemberDecorate %5 1 Offset 12
16
+ OpMemberDecorate %6 0 Offset 0
17
+ OpMemberDecorate %6 1 Offset 16
18
+ OpDecorate %2 Location 0
19
+ OpDecorate %3 Location 0
20
+ %7 = OpTypeFloat 32
21
+ %8 = OpTypeVector %7 3
22
+ %5 = OpTypeStruct %8 %7
23
+ %9 = OpTypePointer Input %5
24
+ %6 = OpTypeStruct %8 %7
25
+ %10 = OpTypePointer Output %6
26
+ %11 = OpTypeVoid
27
+ %12 = OpTypeFunction %11
28
+ %2 = OpVariable %9 Input
29
+ %3 = OpVariable %10 Output
30
+ %1 = OpFunction %11 None %12
31
+ %13 = OpLabel
32
+ %14 = OpLoad %5 %2
33
+ %15 = OpCompositeExtract %7 %14 0 0
34
+ %16 = OpCompositeExtract %7 %14 0 1
35
+ %17 = OpCompositeExtract %7 %14 0 2
36
+ %18 = OpCompositeConstruct %8 %15 %16 %17
37
+ %19 = OpCompositeExtract %7 %14 1
38
+ %20 = OpCompositeConstruct %6 %18 %19
39
+ OpStore %3 %20
40
+ OpNoLine
41
+ OpReturn
42
+ OpFunctionEnd
You can’t perform that action at this time.
0 commit comments