| 1 | mod affine2; |
| 2 | mod affine3a; |
| 3 | mod float; |
| 4 | mod mat3; |
| 5 | pub(crate) mod math; |
| 6 | mod vec2; |
| 7 | mod vec3; |
| 8 | |
| 9 | #[cfg(all(feature = "core-simd", not(feature = "scalar-math")))] |
| 10 | mod coresimd; |
| 11 | |
| 12 | #[cfg(any( |
| 13 | not(any( |
| 14 | feature = "core-simd", |
| 15 | target_arch = "aarch64", |
| 16 | target_feature = "sse2", |
| 17 | target_feature = "simd128" |
| 18 | )), |
| 19 | feature = "scalar-math" |
| 20 | ))] |
| 21 | mod scalar; |
| 22 | |
| 23 | #[cfg(all( |
| 24 | target_arch = "aarch64", |
| 25 | not(any(feature = "core-simd", feature = "scalar-math")) |
| 26 | ))] |
| 27 | mod neon; |
| 28 | |
| 29 | #[cfg(all( |
| 30 | target_feature = "sse2", |
| 31 | not(any(feature = "core-simd", feature = "scalar-math")) |
| 32 | ))] |
| 33 | mod sse2; |
| 34 | |
| 35 | #[cfg(all( |
| 36 | target_feature = "simd128", |
| 37 | not(any(feature = "core-simd", feature = "scalar-math")) |
| 38 | ))] |
| 39 | mod wasm32; |
| 40 | |
| 41 | #[cfg(any( |
| 42 | not(any( |
| 43 | feature = "core-simd", |
| 44 | target_arch = "aarch64", |
| 45 | target_feature = "sse2", |
| 46 | target_feature = "simd128" |
| 47 | )), |
| 48 | feature = "scalar-math" |
| 49 | ))] |
| 50 | use scalar::*; |
| 51 | |
| 52 | #[cfg(all( |
| 53 | target_arch = "aarch64", |
| 54 | not(any(feature = "core-simd", feature = "scalar-math")) |
| 55 | ))] |
| 56 | use neon::*; |
| 57 | |
| 58 | #[cfg(all( |
| 59 | target_feature = "sse2", |
| 60 | not(any(feature = "core-simd", feature = "scalar-math")) |
| 61 | ))] |
| 62 | use sse2::*; |
| 63 | |
| 64 | #[cfg(all( |
| 65 | target_feature = "simd128", |
| 66 | not(any(feature = "core-simd", feature = "scalar-math")) |
| 67 | ))] |
| 68 | use wasm32::*; |
| 69 | |
| 70 | #[cfg(all(feature = "core-simd", not(feature = "scalar-math")))] |
| 71 | use coresimd::*; |
| 72 | |
| 73 | pub use affine2::Affine2; |
| 74 | pub use affine3a::Affine3A; |
| 75 | pub use mat2::{mat2, Mat2}; |
| 76 | pub use mat3::{mat3, Mat3}; |
| 77 | pub use mat3a::{mat3a, Mat3A}; |
| 78 | pub use mat4::{mat4, Mat4}; |
| 79 | pub use quat::{quat, Quat}; |
| 80 | pub use vec2::{vec2, Vec2}; |
| 81 | pub use vec3::{vec3, Vec3}; |
| 82 | pub use vec3a::{vec3a, Vec3A}; |
| 83 | pub use vec4::{vec4, Vec4}; |
| 84 | |
| 85 | #[cfg(not(target_arch = "spirv"))] |
| 86 | mod test { |
| 87 | use super::*; |
| 88 | |
| 89 | #[cfg(all(not(feature = "cuda"), feature = "scalar-math"))] |
| 90 | mod const_test_affine2 { |
| 91 | const_assert_eq!( |
| 92 | core::mem::align_of::<super::Vec2>(), |
| 93 | core::mem::align_of::<super::Affine2>() |
| 94 | ); |
| 95 | const_assert_eq!(24, core::mem::size_of::<super::Affine2>()); |
| 96 | } |
| 97 | |
| 98 | #[cfg(not(feature = "scalar-math"))] |
| 99 | mod const_test_affine2 { |
| 100 | const_assert_eq!(16, core::mem::align_of::<super::Affine2>()); |
| 101 | const_assert_eq!(32, core::mem::size_of::<super::Affine2>()); |
| 102 | } |
| 103 | |
| 104 | mod const_test_mat2 { |
| 105 | #[cfg(feature = "scalar-math")] |
| 106 | const_assert_eq!( |
| 107 | core::mem::align_of::<super::Vec2>(), |
| 108 | core::mem::align_of::<super::Mat2>() |
| 109 | ); |
| 110 | #[cfg(not(any(feature = "scalar-math", target_arch = "spirv")))] |
| 111 | const_assert_eq!(16, core::mem::align_of::<super::Mat2>()); |
| 112 | const_assert_eq!(16, core::mem::size_of::<super::Mat2>()); |
| 113 | } |
| 114 | |
| 115 | mod const_test_mat3 { |
| 116 | const_assert_eq!( |
| 117 | core::mem::align_of::<f32>(), |
| 118 | core::mem::align_of::<super::Mat3>() |
| 119 | ); |
| 120 | const_assert_eq!(36, core::mem::size_of::<super::Mat3>()); |
| 121 | } |
| 122 | |
| 123 | mod const_test_mat3a { |
| 124 | const_assert_eq!(16, core::mem::align_of::<super::Mat3A>()); |
| 125 | const_assert_eq!(48, core::mem::size_of::<super::Mat3A>()); |
| 126 | } |
| 127 | |
| 128 | mod const_test_mat4 { |
| 129 | const_assert_eq!( |
| 130 | core::mem::align_of::<super::Vec4>(), |
| 131 | core::mem::align_of::<super::Mat4>() |
| 132 | ); |
| 133 | const_assert_eq!(64, core::mem::size_of::<super::Mat4>()); |
| 134 | } |
| 135 | |
| 136 | mod const_test_quat { |
| 137 | #[cfg(feature = "scalar-math")] |
| 138 | const_assert_eq!( |
| 139 | core::mem::align_of::<f32>(), |
| 140 | core::mem::align_of::<super::Quat>() |
| 141 | ); |
| 142 | #[cfg(not(any(feature = "scalar-math", target_arch = "spirv")))] |
| 143 | const_assert_eq!(16, core::mem::align_of::<super::Quat>()); |
| 144 | const_assert_eq!(16, core::mem::size_of::<super::Quat>()); |
| 145 | } |
| 146 | |
| 147 | mod const_test_vec2 { |
| 148 | #[cfg(not(feature = "cuda"))] |
| 149 | const_assert_eq!( |
| 150 | core::mem::align_of::<f32>(), |
| 151 | core::mem::align_of::<super::Vec2>() |
| 152 | ); |
| 153 | #[cfg(feature = "cuda")] |
| 154 | const_assert_eq!(8, core::mem::align_of::<super::Vec2>()); |
| 155 | const_assert_eq!(8, core::mem::size_of::<super::Vec2>()); |
| 156 | } |
| 157 | |
| 158 | mod const_test_vec3 { |
| 159 | const_assert_eq!( |
| 160 | core::mem::align_of::<f32>(), |
| 161 | core::mem::align_of::<super::Vec3>() |
| 162 | ); |
| 163 | const_assert_eq!(12, core::mem::size_of::<super::Vec3>()); |
| 164 | } |
| 165 | |
| 166 | mod const_test_vec3a { |
| 167 | const_assert_eq!(16, core::mem::align_of::<super::Vec3A>()); |
| 168 | const_assert_eq!(16, core::mem::size_of::<super::Vec3A>()); |
| 169 | } |
| 170 | |
| 171 | mod const_test_vec4 { |
| 172 | #[cfg(all(feature = "scalar-math", not(feature = "cuda")))] |
| 173 | const_assert_eq!( |
| 174 | core::mem::align_of::<f32>(), |
| 175 | core::mem::align_of::<super::Vec4>() |
| 176 | ); |
| 177 | #[cfg(not(feature = "scalar-math"))] |
| 178 | const_assert_eq!(16, core::mem::align_of::<super::Vec4>()); |
| 179 | const_assert_eq!(16, core::mem::size_of::<super::Vec4>()); |
| 180 | } |
| 181 | } |