Skip to content

Commit f14db4e

Browse files
committed
abi layout difftest: add all remaining glam types
1 parent e15e140 commit f14db4e

File tree

1 file changed

+80
-1
lines changed
  • tests/difftests/tests/lang/abi/vector_layout/cpu/src

1 file changed

+80
-1
lines changed

tests/difftests/tests/lang/abi/vector_layout/cpu/src/layout.rs

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ macro_rules! write_layout {
3030
}
3131

3232
/// gid is checked between `0..LAYOUT_COUNT`
33-
pub const LAYOUT_COUNT: usize = 0x40;
33+
pub const LAYOUT_COUNT: usize = 0x60;
3434
/// at byte offset 0x100 * N starts layout N
3535
pub const LAYOUT_MAX_SIZE: usize = 0x100 / 0x4;
3636
pub const LAYOUT_LEN: usize = LAYOUT_COUNT * LAYOUT_MAX_SIZE;
@@ -52,10 +52,74 @@ pub fn eval_layouts(gid: u32, out: &mut [u32]) {
5252
0xC => write_layout!(out, offset, UVec4(x, y, z, w)),
5353
0xD => write_layout!(out, offset, IVec4(x, y, z, w)),
5454
0xE => write_layout!(out, offset, Vec4()), // private members
55+
0xF => write_layout!(out, offset, Quat()), // private members
5556

5657
// experiments structs
5758
0x10 => write_layout!(out, offset, Struct0x10(a, b)),
5859
0x11 => write_layout!(out, offset, Struct0x11(a, b)),
60+
0x12 => write_layout!(out, offset, Struct0x12(a, b, c, d, e)),
61+
0x13 => write_layout!(out, offset, Struct0x13(a)),
62+
63+
// mat
64+
0x20 => write_layout!(out, offset, Mat2()), // private members
65+
0x21 => write_layout!(out, offset, Mat3(x_axis, y_axis, z_axis)),
66+
0x22 => write_layout!(out, offset, Mat3A(x_axis, y_axis, z_axis)),
67+
0x23 => write_layout!(out, offset, Mat4(x_axis, y_axis, z_axis, w_axis)),
68+
// f64
69+
0x24 => write_layout!(out, offset, f64()),
70+
0x25 => write_layout!(out, offset, DVec2(x, y)),
71+
0x26 => write_layout!(out, offset, DVec3(x, y, z)),
72+
0x27 => write_layout!(out, offset, DVec4(x, y, z, w)),
73+
0x28 => write_layout!(out, offset, DQuat(x, y, z, w)),
74+
0x29 => write_layout!(out, offset, DMat2()), // private members
75+
0x2a => write_layout!(out, offset, DMat3(x_axis, y_axis, z_axis)),
76+
0x2b => write_layout!(out, offset, DMat4(x_axis, y_axis, z_axis, w_axis)),
77+
78+
// i8
79+
0x30 => write_layout!(out, offset, i8()),
80+
0x31 => write_layout!(out, offset, I8Vec2(x, y)),
81+
0x32 => write_layout!(out, offset, I8Vec3(x, y, z)),
82+
0x33 => write_layout!(out, offset, I8Vec4(x, y, z, w)),
83+
// i16
84+
0x34 => write_layout!(out, offset, i16()),
85+
0x35 => write_layout!(out, offset, I16Vec2(x, y)),
86+
0x36 => write_layout!(out, offset, I16Vec3(x, y, z)),
87+
0x37 => write_layout!(out, offset, I16Vec4(x, y, z, w)),
88+
// i64
89+
0x38 => write_layout!(out, offset, i64()),
90+
0x39 => write_layout!(out, offset, I64Vec2(x, y)),
91+
0x3a => write_layout!(out, offset, I64Vec3(x, y, z)),
92+
0x3b => write_layout!(out, offset, I64Vec4(x, y, z, w)),
93+
94+
// u8
95+
0x40 => write_layout!(out, offset, u8()),
96+
0x41 => write_layout!(out, offset, U8Vec2(x, y)),
97+
0x42 => write_layout!(out, offset, U8Vec3(x, y, z)),
98+
0x43 => write_layout!(out, offset, U8Vec4(x, y, z, w)),
99+
// u16
100+
0x44 => write_layout!(out, offset, u16()),
101+
0x45 => write_layout!(out, offset, U16Vec2(x, y)),
102+
0x46 => write_layout!(out, offset, U16Vec3(x, y, z)),
103+
0x47 => write_layout!(out, offset, U16Vec4(x, y, z, w)),
104+
// u64
105+
0x48 => write_layout!(out, offset, u64()),
106+
0x49 => write_layout!(out, offset, U64Vec2(x, y)),
107+
0x4a => write_layout!(out, offset, U64Vec3(x, y, z)),
108+
0x4b => write_layout!(out, offset, U64Vec4(x, y, z, w)),
109+
// Affine
110+
0x4c => write_layout!(out, offset, Affine2(matrix2, translation)),
111+
0x4d => write_layout!(out, offset, Affine3A(matrix3, translation)),
112+
0x4e => write_layout!(out, offset, DAffine2(matrix2, translation)),
113+
0x4f => write_layout!(out, offset, DAffine3(matrix3, translation)),
114+
115+
// bool
116+
0x50 => write_layout!(out, offset, bool()),
117+
0x51 => write_layout!(out, offset, BVec2(x, y)),
118+
0x52 => write_layout!(out, offset, BVec3(x, y, z)),
119+
0x53 => write_layout!(out, offset, BVec3A()), // private members
120+
0x54 => write_layout!(out, offset, BVec4(x, y, z, w)),
121+
0x55 => write_layout!(out, offset, BVec4A()),
122+
59123
_ => {}
60124
}
61125
}
@@ -80,4 +144,19 @@ mod experiments {
80144
/// * 16 (GPU): 32 size, 16 alignment, 16 b offset
81145
pub b: f32,
82146
}
147+
148+
#[repr(C)]
149+
pub struct Struct0x12 {
150+
pub a: BVec3,
151+
pub b: f32,
152+
pub c: BVec2,
153+
pub d: f32,
154+
pub e: BVec4,
155+
}
156+
157+
#[repr(C)]
158+
#[repr(align(16))]
159+
pub struct Struct0x13 {
160+
pub a: f32,
161+
}
83162
}

0 commit comments

Comments
 (0)