From 3c85a6ac41397cf95199933c6a93909bc070a844 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Tue, 8 Sep 2020 21:18:17 +0200 Subject: Start implementing ray-casting. This adds a QueryPipeline structure responsible for scene queries. Currently this structure is able to perform a brute-force ray-cast. This commit also includes the beginning of implementation of a SIMD-based acceleration structure which will be used for these scene queries in the future. --- src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 118ac23..8cbf673 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,6 @@ macro_rules! enable_flush_to_zero( } ); -#[cfg(feature = "simd-is-enabled")] macro_rules! array( ($callback: expr; SIMD_WIDTH) => { { @@ -139,7 +138,6 @@ pub mod utils; #[cfg(feature = "dim2")] /// Math primitives used throughout Rapier. pub mod math { - #[cfg(feature = "simd-is-enabled")] pub use super::simd::*; use na::{Isometry2, Matrix2, Point2, Translation2, UnitComplex, Vector2, Vector3, U1, U2}; @@ -182,7 +180,6 @@ pub mod math { #[cfg(feature = "dim3")] /// Math primitives used throughout Rapier. pub mod math { - #[cfg(feature = "simd-is-enabled")] pub use super::simd::*; use na::{Isometry3, Matrix3, Point3, Translation3, UnitQuaternion, Vector3, Vector6, U3}; @@ -220,6 +217,12 @@ pub mod math { pub type SdpMatrix = crate::utils::SdpMatrix3; } +#[cfg(not(feature = "simd-is-enabled"))] +mod simd { + /// The number of lanes of a SIMD number. + pub const SIMD_WIDTH: usize = 4; +} + #[cfg(feature = "simd-is-enabled")] mod simd { #[allow(unused_imports)] -- cgit From 84bd60e4a5b88c9aa824797c8a444945b46e96b2 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 22 Sep 2020 17:57:29 +0200 Subject: Fix compilation when SIMD is not enabled. --- src/lib.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 8cbf673..3674717 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -219,8 +219,15 @@ pub mod math { #[cfg(not(feature = "simd-is-enabled"))] mod simd { + use simba::simd::{AutoBoolx4, AutoF32x4}; /// The number of lanes of a SIMD number. pub const SIMD_WIDTH: usize = 4; + /// SIMD_WIDTH - 1 + pub const SIMD_LAST_INDEX: usize = 3; + /// A SIMD float with SIMD_WIDTH lanes. + pub type SimdFloat = AutoF32x4; + /// A SIMD bool with SIMD_WIDTH lanes. + pub type SimdBool = AutoBoolx4; } #[cfg(feature = "simd-is-enabled")] @@ -236,16 +243,16 @@ mod simd { /// SIMD_WIDTH - 1 pub const SIMD_LAST_INDEX: usize = 3; #[cfg(not(feature = "simd-nightly"))] - /// A SIMD float with SIMD_WIDTH lanes. + /// A SIMD float with SIMD_WIDTH lanes. pub type SimdFloat = WideF32x4; #[cfg(not(feature = "simd-nightly"))] - /// A SIMD bool with SIMD_WIDTH lanes. + /// A SIMD bool with SIMD_WIDTH lanes. pub type SimdBool = WideBoolF32x4; #[cfg(feature = "simd-nightly")] - /// A SIMD float with SIMD_WIDTH lanes. + /// A SIMD float with SIMD_WIDTH lanes. pub type SimdFloat = f32x4; #[cfg(feature = "simd-nightly")] - /// A bool float with SIMD_WIDTH lanes. + /// A bool float with SIMD_WIDTH lanes. pub type SimdBool = m32x4; // pub const SIMD_WIDTH: usize = 8; -- cgit