File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ // Create several type definitions to test `align` and `size` layout.
2+
3+ struct NoPadding {
4+ @location (0 )
5+ v3 : vec3f , // align 16, size 12; no start padding needed
6+ @location (1 )
7+ f3 : f32 , // align 4, size 4; no start padding needed
8+ }
9+ // struct NoPaddingNoBindings {
10+ // v3: vec3f,
11+ // f3: f32,
12+ // }
13+ @fragment
14+ fn no_padding_frag (input : NoPadding ) -> @location (0 ) vec4f {
15+ _ = input ;
16+ return vec4f (0 .0 );
17+ }
18+ @vertex
19+ fn no_padding_vert (input : NoPadding ) -> @builtin (position ) vec4f {
20+ _ = input ;
21+ return vec4f (0 .0 );
22+ }
23+
24+ struct NeedsPadding {
25+ @location (0 ) f3_forces_padding : f32 , // align 4, size 4; no start padding needed
26+ @location (1 ) v3_needs_padding : vec3f , // align 16, size 12; needs 12 bytes of padding
27+ @location (2 ) f3 : f32 , // align 4, size 4; no start padding needed
28+ }
29+ // struct NeedsPaddingNoBindings {
30+ // f3_forces_padding: f32,
31+ // v3_needs_padding: vec3f,
32+ // f3: f32,
33+ // }
34+ @fragment
35+ fn needs_padding_frag (input : NeedsPadding ) -> @location (0 ) vec4f {
36+ _ = input ;
37+ return vec4f (0 .0 );
38+ }
39+ @vertex
40+ fn needs_padding_vert (input : NeedsPadding ) -> @builtin (position ) vec4f {
41+ _ = input ;
42+ return vec4f (0 .0 );
43+ }
You can’t perform that action at this time.
0 commit comments