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