Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/f32/affine2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ use core::ops::{Deref, DerefMut, Mul, MulAssign};
/// A 2D affine transform, which can represent translation, rotation, scaling and shear.
#[derive(Copy, Clone)]
#[cfg_attr(
all(feature = "bytemuck", not(feature = "scalar-math")),
all(
feature = "bytemuck",
not(any(feature = "scalar-math", target_arch = "spirv"))
),
derive(bytemuck::AnyBitPattern)
)]
#[cfg_attr(
all(feature = "bytemuck", feature = "scalar-math"),
all(
feature = "bytemuck",
feature = "scalar-math",
not(target_arch = "spirv")
),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
Expand Down
5 changes: 4 additions & 1 deletion src/f32/affine3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use core::ops::{Deref, DerefMut, Mul, MulAssign};
///
/// This type is 16 byte aligned.
#[derive(Copy, Clone)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::AnyBitPattern))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::AnyBitPattern)
)]
#[repr(C)]
pub struct Affine3A {
pub matrix3: Mat3A,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/coresimd/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ pub const fn mat2(x_axis: Vec2, y_axis: Vec2) -> Mat2 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Mat2(pub(crate) f32x4);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/coresimd/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub const fn mat3a(x_axis: Vec3A, y_axis: Vec3A, z_axis: Vec3A) -> Mat3A {
/// vectors respectively. These methods assume that `Self` contains a valid affine
/// transform.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat3A {
pub x_axis: Vec3A,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/coresimd/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ pub const fn mat4(x_axis: Vec4, y_axis: Vec4, z_axis: Vec4, w_axis: Vec4) -> Mat
/// The resulting perspective project can be use to transform 3D vectors as points with
/// perspective correction using the [`Self::project_point3()`] convenience method.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat4 {
pub x_axis: Vec4,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/coresimd/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ pub const fn quat(x: f32, y: f32, z: f32, w: f32) -> Quat {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Quat(pub(crate) f32x4);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/coresimd/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ pub const fn vec3a(x: f32, y: f32, z: f32) -> Vec3A {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Vec3A(pub(crate) f32x4);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/coresimd/vec4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ pub const fn vec4(x: f32, y: f32, z: f32, w: f32) -> Vec4 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Vec4(pub(crate) f32x4);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/mat3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ pub const fn mat3(x_axis: Vec3, y_axis: Vec3, z_axis: Vec3) -> Mat3 {
/// vectors respectively. These methods assume that `Self` contains a valid affine
/// transform.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat3 {
pub x_axis: Vec3,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/neon/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ pub const fn mat2(x_axis: Vec2, y_axis: Vec2) -> Mat2 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Mat2(pub(crate) float32x4_t);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/neon/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub const fn mat3a(x_axis: Vec3A, y_axis: Vec3A, z_axis: Vec3A) -> Mat3A {
/// vectors respectively. These methods assume that `Self` contains a valid affine
/// transform.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat3A {
pub x_axis: Vec3A,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/neon/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ pub const fn mat4(x_axis: Vec4, y_axis: Vec4, z_axis: Vec4, w_axis: Vec4) -> Mat
/// The resulting perspective project can be use to transform 3D vectors as points with
/// perspective correction using the [`Self::project_point3()`] convenience method.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat4 {
pub x_axis: Vec4,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/neon/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ pub const fn quat(x: f32, y: f32, z: f32, w: f32) -> Quat {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Quat(pub(crate) float32x4_t);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/neon/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ pub const fn vec3a(x: f32, y: f32, z: f32) -> Vec3A {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Vec3A(pub(crate) float32x4_t);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/neon/vec4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ pub const fn vec4(x: f32, y: f32, z: f32, w: f32) -> Vec4 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Vec4(pub(crate) float32x4_t);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/scalar/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ pub const fn mat2(x_axis: Vec2, y_axis: Vec2) -> Mat2 {

/// A 2x2 column major matrix.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[cfg_attr(
not(any(feature = "scalar-math", target_arch = "spirv")),
repr(align(16))
Expand Down
5 changes: 4 additions & 1 deletion src/f32/scalar/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ pub const fn mat3a(x_axis: Vec3A, y_axis: Vec3A, z_axis: Vec3A) -> Mat3A {
/// vectors respectively. These methods assume that `Self` contains a valid affine
/// transform.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::AnyBitPattern))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::AnyBitPattern)
)]
#[repr(C)]
pub struct Mat3A {
pub x_axis: Vec3A,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/scalar/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ pub const fn mat4(x_axis: Vec4, y_axis: Vec4, z_axis: Vec4, w_axis: Vec4) -> Mat
/// The resulting perspective project can be use to transform 3D vectors as points with
/// perspective correction using the [`Self::project_point3()`] convenience method.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[cfg_attr(
any(
not(any(feature = "scalar-math", target_arch = "spirv")),
Expand Down
5 changes: 4 additions & 1 deletion src/f32/scalar/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ pub const fn quat(x: f32, y: f32, z: f32, w: f32) -> Quat {
/// floating point "error creep" which can occur when successive quaternion
/// operations are applied.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[cfg_attr(
not(any(feature = "scalar-math", target_arch = "spirv")),
repr(align(16))
Expand Down
5 changes: 4 additions & 1 deletion src/f32/scalar/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ pub const fn vec3a(x: f32, y: f32, z: f32) -> Vec3A {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy, PartialEq)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::AnyBitPattern))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::AnyBitPattern)
)]
#[cfg_attr(not(target_arch = "spirv"), repr(align(16)))]
#[cfg_attr(not(target_arch = "spirv"), repr(C))]
#[cfg_attr(target_arch = "spirv", repr(simd))]
Expand Down
5 changes: 4 additions & 1 deletion src/f32/scalar/vec4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ pub const fn vec4(x: f32, y: f32, z: f32, w: f32) -> Vec4 {

/// A 4-dimensional vector.
#[derive(Clone, Copy, PartialEq)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[cfg_attr(
any(
not(any(feature = "scalar-math", target_arch = "spirv")),
Expand Down
5 changes: 4 additions & 1 deletion src/f32/sse2/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ pub const fn mat2(x_axis: Vec2, y_axis: Vec2) -> Mat2 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Mat2(pub(crate) __m128);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/sse2/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ pub const fn mat3a(x_axis: Vec3A, y_axis: Vec3A, z_axis: Vec3A) -> Mat3A {
/// vectors respectively. These methods assume that `Self` contains a valid affine
/// transform.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat3A {
pub x_axis: Vec3A,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/sse2/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ pub const fn mat4(x_axis: Vec4, y_axis: Vec4, z_axis: Vec4, w_axis: Vec4) -> Mat
/// The resulting perspective project can be use to transform 3D vectors as points with
/// perspective correction using the [`Self::project_point3()`] convenience method.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat4 {
pub x_axis: Vec4,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/sse2/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub const fn quat(x: f32, y: f32, z: f32, w: f32) -> Quat {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Quat(pub(crate) __m128);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/sse2/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ pub const fn vec3a(x: f32, y: f32, z: f32) -> Vec3A {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Vec3A(pub(crate) __m128);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/sse2/vec4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ pub const fn vec4(x: f32, y: f32, z: f32, w: f32) -> Vec4 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Vec4(pub(crate) __m128);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/vec2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ pub const fn vec2(x: f32, y: f32) -> Vec2 {

/// A 2-dimensional vector.
#[derive(Clone, Copy, PartialEq)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[cfg_attr(feature = "cuda", repr(align(8)))]
#[cfg_attr(not(target_arch = "spirv"), repr(C))]
#[cfg_attr(target_arch = "spirv", repr(simd))]
Expand Down
5 changes: 4 additions & 1 deletion src/f32/vec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ pub const fn vec3(x: f32, y: f32, z: f32) -> Vec3 {

/// A 3-dimensional vector.
#[derive(Clone, Copy, PartialEq)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[cfg_attr(not(target_arch = "spirv"), repr(C))]
#[cfg_attr(target_arch = "spirv", repr(simd))]
pub struct Vec3 {
Expand Down
5 changes: 4 additions & 1 deletion src/f32/wasm32/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ pub const fn mat2(x_axis: Vec2, y_axis: Vec2) -> Mat2 {
///
/// This type is 16 byte aligned.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(transparent)]
pub struct Mat2(pub(crate) v128);

Expand Down
5 changes: 4 additions & 1 deletion src/f32/wasm32/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub const fn mat3a(x_axis: Vec3A, y_axis: Vec3A, z_axis: Vec3A) -> Mat3A {
/// vectors respectively. These methods assume that `Self` contains a valid affine
/// transform.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat3A {
pub x_axis: Vec3A,
Expand Down
5 changes: 4 additions & 1 deletion src/f32/wasm32/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ pub const fn mat4(x_axis: Vec4, y_axis: Vec4, z_axis: Vec4, w_axis: Vec4) -> Mat
/// The resulting perspective project can be use to transform 3D vectors as points with
/// perspective correction using the [`Self::project_point3()`] convenience method.
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
all(feature = "bytemuck", not(target_arch = "spirv")),
derive(bytemuck::Pod, bytemuck::Zeroable)
)]
#[repr(C)]
pub struct Mat4 {
pub x_axis: Vec4,
Expand Down
Loading
Loading