forked from M-Labs/nalgebra
Use cust_core instead of cust
This commit is contained in:
parent
dd471d7a7e
commit
213a9fbd21
@ -32,7 +32,7 @@ compare = [ "matrixcompare-core" ]
|
|||||||
libm = [ "simba/libm" ]
|
libm = [ "simba/libm" ]
|
||||||
libm-force = [ "simba/libm_force" ]
|
libm-force = [ "simba/libm_force" ]
|
||||||
macros = [ "nalgebra-macros" ]
|
macros = [ "nalgebra-macros" ]
|
||||||
cuda = [ "cust", "simba/cuda" ]
|
cuda = [ "cust_core", "simba/cuda" ]
|
||||||
|
|
||||||
# Conversion
|
# Conversion
|
||||||
convert-mint = [ "mint" ]
|
convert-mint = [ "mint" ]
|
||||||
@ -96,9 +96,7 @@ glam017 = { package = "glam", version = "0.17", optional = true }
|
|||||||
glam018 = { package = "glam", version = "0.18", optional = true }
|
glam018 = { package = "glam", version = "0.18", optional = true }
|
||||||
glam019 = { package = "glam", version = "0.19", optional = true }
|
glam019 = { package = "glam", version = "0.19", optional = true }
|
||||||
glam020 = { package = "glam", version = "0.20", optional = true }
|
glam020 = { package = "glam", version = "0.20", optional = true }
|
||||||
|
cust_core = { version = "0.1", optional = true }
|
||||||
[target.'cfg(not(target_os = "cuda"))'.dependencies]
|
|
||||||
cust = { version = "0.3", optional = true }
|
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -27,10 +27,7 @@ use std::mem;
|
|||||||
/// A array-based statically sized matrix data storage.
|
/// A array-based statically sized matrix data storage.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub struct ArrayStorage<T, const R: usize, const C: usize>(pub [[T; R]; C]);
|
pub struct ArrayStorage<T, const R: usize, const C: usize>(pub [[T; R]; C]);
|
||||||
|
|
||||||
impl<T, const R: usize, const C: usize> ArrayStorage<T, R, C> {
|
impl<T, const R: usize, const C: usize> ArrayStorage<T, R, C> {
|
||||||
|
@ -13,10 +13,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
|||||||
|
|
||||||
/// Dim of dynamically-sized algebraic entities.
|
/// Dim of dynamically-sized algebraic entities.
|
||||||
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub struct Dynamic {
|
pub struct Dynamic {
|
||||||
value: usize,
|
value: usize,
|
||||||
}
|
}
|
||||||
@ -201,10 +198,7 @@ dim_ops!(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub struct Const<const R: usize>;
|
pub struct Const<const R: usize>;
|
||||||
|
|
||||||
/// Trait implemented exclusively by type-level integers.
|
/// Trait implemented exclusively by type-level integers.
|
||||||
|
@ -150,10 +150,7 @@ pub type MatrixCross<T, R1, C1, R2, C2> =
|
|||||||
/// some concrete types for `T` and a compatible data storage type `S`).
|
/// some concrete types for `T` and a compatible data storage type `S`).
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub struct Matrix<T, R, C, S> {
|
pub struct Matrix<T, R, C, S> {
|
||||||
/// The data storage that contains all the matrix components. Disappointed?
|
/// The data storage that contains all the matrix components. Disappointed?
|
||||||
///
|
///
|
||||||
|
@ -21,10 +21,7 @@ use crate::{Dim, Matrix, OMatrix, RealField, Scalar, SimdComplexField, SimdRealF
|
|||||||
/// in their documentation, read their dedicated pages directly.
|
/// in their documentation, read their dedicated pages directly.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Clone, Hash, Copy)]
|
#[derive(Clone, Hash, Copy)]
|
||||||
// #[cfg_attr(
|
// #[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
// all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
// derive(cust::DeviceCopy)
|
|
||||||
// )]
|
|
||||||
pub struct Unit<T> {
|
pub struct Unit<T> {
|
||||||
pub(crate) value: T,
|
pub(crate) value: T,
|
||||||
}
|
}
|
||||||
@ -102,9 +99,8 @@ mod rkyv_impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(not(target_os = "cuda"), feature = "cuda"))]
|
#[cfg(feature = "cuda")]
|
||||||
unsafe impl<T: cust::memory::DeviceCopy, R, C, S> cust::memory::DeviceCopy
|
unsafe impl<T: cust_core::DeviceCopy, R, C, S> cust_core::DeviceCopy for Unit<Matrix<T, R, C, S>>
|
||||||
for Unit<Matrix<T, R, C, S>>
|
|
||||||
where
|
where
|
||||||
T: Scalar,
|
T: Scalar,
|
||||||
R: Dim,
|
R: Dim,
|
||||||
|
@ -39,10 +39,7 @@ use simba::scalar::{ClosedNeg, RealField};
|
|||||||
/// See <https://github.com/dimforge/nalgebra/issues/487>
|
/// See <https://github.com/dimforge/nalgebra/issues/487>
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub struct DualQuaternion<T> {
|
pub struct DualQuaternion<T> {
|
||||||
/// The real component of the quaternion
|
/// The real component of the quaternion
|
||||||
pub real: Quaternion<T>,
|
pub real: Quaternion<T>,
|
||||||
|
@ -50,10 +50,7 @@ use crate::geometry::{AbstractRotation, Point, Translation};
|
|||||||
///
|
///
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serde-serialize-no-std",
|
feature = "serde-serialize-no-std",
|
||||||
|
@ -19,10 +19,7 @@ use crate::geometry::{Point3, Projective3};
|
|||||||
|
|
||||||
/// A 3D orthographic projection stored as a homogeneous 4x4 matrix.
|
/// A 3D orthographic projection stored as a homogeneous 4x4 matrix.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Orthographic3<T> {
|
pub struct Orthographic3<T> {
|
||||||
matrix: Matrix4<T>,
|
matrix: Matrix4<T>,
|
||||||
|
@ -20,10 +20,7 @@ use crate::geometry::{Point3, Projective3};
|
|||||||
|
|
||||||
/// A 3D perspective projection stored as a homogeneous 4x4 matrix.
|
/// A 3D perspective projection stored as a homogeneous 4x4 matrix.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Perspective3<T> {
|
pub struct Perspective3<T> {
|
||||||
matrix: Matrix4<T>,
|
matrix: Matrix4<T>,
|
||||||
|
@ -69,12 +69,11 @@ where
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(not(target_os = "cuda"), feature = "cuda"))]
|
#[cfg(feature = "cuda")]
|
||||||
unsafe impl<T: Scalar + cust::memory::DeviceCopy, D: DimName> cust::memory::DeviceCopy
|
unsafe impl<T: Scalar + cust_core::DeviceCopy, D: DimName> cust_core::DeviceCopy for OPoint<T, D>
|
||||||
for OPoint<T, D>
|
|
||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<T, D>,
|
DefaultAllocator: Allocator<T, D>,
|
||||||
OVector<T, D>: cust::memory::DeviceCopy,
|
OVector<T, D>: cust_core::DeviceCopy,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,7 @@ use crate::geometry::{Point3, Rotation};
|
|||||||
/// that may be used as a rotation.
|
/// that may be used as a rotation.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub struct Quaternion<T> {
|
pub struct Quaternion<T> {
|
||||||
/// This quaternion as a 4D vector of coordinates in the `[ x, y, z, w ]` storage order.
|
/// This quaternion as a 4D vector of coordinates in the `[ x, y, z, w ]` storage order.
|
||||||
pub coords: Vector4<T>,
|
pub coords: Vector4<T>,
|
||||||
@ -1045,8 +1042,8 @@ impl<T: RealField + fmt::Display> fmt::Display for Quaternion<T> {
|
|||||||
/// A unit quaternions. May be used to represent a rotation.
|
/// A unit quaternions. May be used to represent a rotation.
|
||||||
pub type UnitQuaternion<T> = Unit<Quaternion<T>>;
|
pub type UnitQuaternion<T> = Unit<Quaternion<T>>;
|
||||||
|
|
||||||
#[cfg(all(not(target_os = "cuda"), feature = "cuda"))]
|
#[cfg(feature = "cuda")]
|
||||||
unsafe impl<T: cust::memory::DeviceCopy> cust::memory::DeviceCopy for UnitQuaternion<T> {}
|
unsafe impl<T: cust_core::DeviceCopy> cust_core::DeviceCopy for UnitQuaternion<T> {}
|
||||||
|
|
||||||
impl<T: Scalar + ClosedNeg + PartialEq> PartialEq for UnitQuaternion<T> {
|
impl<T: Scalar + ClosedNeg + PartialEq> PartialEq for UnitQuaternion<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -49,10 +49,7 @@ use crate::geometry::Point;
|
|||||||
/// * [Conversion to a matrix <span style="float:right;">`matrix`, `to_homogeneous`…</span>](#conversion-to-a-matrix)
|
/// * [Conversion to a matrix <span style="float:right;">`matrix`, `to_homogeneous`…</span>](#conversion-to-a-matrix)
|
||||||
///
|
///
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Rotation<T, const D: usize> {
|
pub struct Rotation<T, const D: usize> {
|
||||||
matrix: SMatrix<T, D, D>,
|
matrix: SMatrix<T, D, D>,
|
||||||
|
@ -17,10 +17,7 @@ use crate::geometry::Point;
|
|||||||
|
|
||||||
/// A scale which supports non-uniform scaling.
|
/// A scale which supports non-uniform scaling.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Scale<T, const D: usize> {
|
pub struct Scale<T, const D: usize> {
|
||||||
/// The scale coordinates, i.e., how much is multiplied to a point's coordinates when it is
|
/// The scale coordinates, i.e., how much is multiplied to a point's coordinates when it is
|
||||||
|
@ -18,10 +18,7 @@ use crate::geometry::{AbstractRotation, Isometry, Point, Translation};
|
|||||||
/// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation.
|
/// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serde-serialize-no-std",
|
feature = "serde-serialize-no-std",
|
||||||
|
@ -60,26 +60,17 @@ where
|
|||||||
|
|
||||||
/// Tag representing the most general (not necessarily inversible) `Transform` type.
|
/// Tag representing the most general (not necessarily inversible) `Transform` type.
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub enum TGeneral {}
|
pub enum TGeneral {}
|
||||||
|
|
||||||
/// Tag representing the most general inversible `Transform` type.
|
/// Tag representing the most general inversible `Transform` type.
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub enum TProjective {}
|
pub enum TProjective {}
|
||||||
|
|
||||||
/// Tag representing an affine `Transform`. Its bottom-row is equal to `(0, 0 ... 0, 1)`.
|
/// Tag representing an affine `Transform`. Its bottom-row is equal to `(0, 0 ... 0, 1)`.
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
pub enum TAffine {}
|
pub enum TAffine {}
|
||||||
|
|
||||||
impl TCategory for TGeneral {
|
impl TCategory for TGeneral {
|
||||||
@ -207,13 +198,13 @@ where
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(not(target_os = "cuda"), feature = "cuda"))]
|
#[cfg(feature = "cuda")]
|
||||||
unsafe impl<T: RealField + cust::memory::DeviceCopy, C: TCategory, const D: usize>
|
unsafe impl<T: RealField + cust_core::DeviceCopy, C: TCategory, const D: usize>
|
||||||
cust::memory::DeviceCopy for Transform<T, C, D>
|
cust_core::DeviceCopy for Transform<T, C, D>
|
||||||
where
|
where
|
||||||
Const<D>: DimNameAdd<U1>,
|
Const<D>: DimNameAdd<U1>,
|
||||||
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
|
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
|
||||||
Owned<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: cust::memory::DeviceCopy,
|
Owned<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: cust_core::DeviceCopy,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,7 @@ use crate::geometry::Point;
|
|||||||
|
|
||||||
/// A translation.
|
/// A translation.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||||
all(not(target_os = "cuda"), feature = "cuda"),
|
|
||||||
derive(cust::DeviceCopy)
|
|
||||||
)]
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Translation<T, const D: usize> {
|
pub struct Translation<T, const D: usize> {
|
||||||
/// The translation coordinates, i.e., how much is added to a point's coordinates when it is
|
/// The translation coordinates, i.e., how much is added to a point's coordinates when it is
|
||||||
|
@ -31,8 +31,8 @@ use std::cmp::{Eq, PartialEq};
|
|||||||
/// * [Conversion to a matrix <span style="float:right;">`to_rotation_matrix`, `to_homogeneous`…</span>](#conversion-to-a-matrix)
|
/// * [Conversion to a matrix <span style="float:right;">`to_rotation_matrix`, `to_homogeneous`…</span>](#conversion-to-a-matrix)
|
||||||
pub type UnitComplex<T> = Unit<Complex<T>>;
|
pub type UnitComplex<T> = Unit<Complex<T>>;
|
||||||
|
|
||||||
#[cfg(all(not(target_os = "cuda"), feature = "cuda"))]
|
#[cfg(feature = "cuda")]
|
||||||
unsafe impl<T: cust::memory::DeviceCopy> cust::memory::DeviceCopy for UnitComplex<T> {}
|
unsafe impl<T: cust_core::DeviceCopy> cust_core::DeviceCopy for UnitComplex<T> {}
|
||||||
|
|
||||||
impl<T: Scalar + PartialEq> PartialEq for UnitComplex<T> {
|
impl<T: Scalar + PartialEq> PartialEq for UnitComplex<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
Loading…
Reference in New Issue
Block a user