Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda safety fixes #198

Merged
merged 3 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
105 changes: 54 additions & 51 deletions src/Imath/ImathBox.h

Large diffs are not rendered by default.

113 changes: 59 additions & 54 deletions src/Imath/ImathColor.h

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions src/Imath/ImathEuler.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ template <class T> class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3<T>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Matrix44<T>&, Order o = Default) IMATH_NOEXCEPT;

/// Destructor
~Euler() = default;
IMATH_HOSTDEVICE ~Euler() = default;

/// @}

Expand Down Expand Up @@ -380,7 +380,7 @@ typedef Euler<double> Eulerd;
/// @cond Doxygen_Suppress

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::angleOrder (int& i, int& j, int& k) const IMATH_NOEXCEPT
{
i = _initialAxis;
Expand All @@ -389,7 +389,7 @@ Euler<T>::angleOrder (int& i, int& j, int& k) const IMATH_NOEXCEPT
}

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::angleMapping (int& i, int& j, int& k) const IMATH_NOEXCEPT
{
int m[3];
Expand All @@ -403,7 +403,7 @@ Euler<T>::angleMapping (int& i, int& j, int& k) const IMATH_NOEXCEPT
}

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::setXYZVector (const Vec3<T>& v) IMATH_NOEXCEPT
{
int i, j, k;
Expand All @@ -414,7 +414,7 @@ Euler<T>::setXYZVector (const Vec3<T>& v) IMATH_NOEXCEPT
}

template <class T>
inline Vec3<T>
IMATH_HOSTDEVICE inline Vec3<T>
Euler<T>::toXYZVector() const IMATH_NOEXCEPT
{
int i, j, k;
Expand All @@ -423,7 +423,7 @@ Euler<T>::toXYZVector() const IMATH_NOEXCEPT
}

template <class T>
constexpr inline Euler<T>::Euler() IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr inline Euler<T>::Euler() IMATH_NOEXCEPT
: Vec3<T> (0, 0, 0),
_frameStatic (true),
_initialRepeated (false),
Expand All @@ -432,7 +432,7 @@ constexpr inline Euler<T>::Euler() IMATH_NOEXCEPT
{}

template <class T>
IMATH_CONSTEXPR14 inline Euler<T>::Euler (typename Euler<T>::Order p) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler<T>::Euler (typename Euler<T>::Order p) IMATH_NOEXCEPT
: Vec3<T> (0, 0, 0),
_frameStatic (true),
_initialRepeated (false),
Expand All @@ -443,7 +443,7 @@ IMATH_CONSTEXPR14 inline Euler<T>::Euler (typename Euler<T>::Order p) IMATH_NOEX
}

template <class T>
IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Vec3<T>& v,
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Vec3<T>& v,
typename Euler<T>::Order p,
typename Euler<T>::InputLayout l) IMATH_NOEXCEPT
{
Expand All @@ -458,24 +458,24 @@ IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Vec3<T>& v,
}
}

template <class T> IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Euler<T>& euler) IMATH_NOEXCEPT
template <class T>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Euler<T>& euler) IMATH_NOEXCEPT
{
operator= (euler);
}

template <class T> IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Euler<T>& euler, Order p) IMATH_NOEXCEPT
template <class T>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Euler<T>& euler, Order p) IMATH_NOEXCEPT
{
setOrder (p);
Matrix33<T> M = euler.toMatrix33();
extract (M);
}

template <class T>
IMATH_CONSTEXPR14 inline Euler<T>::Euler (T xi,
T yi,
T zi,
typename Euler<T>::Order p,
typename Euler<T>::InputLayout l) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline
Euler<T>::Euler (T xi, T yi, T zi, typename Euler<T>::Order p,
typename Euler<T>::InputLayout l) IMATH_NOEXCEPT
{
setOrder (p);
if (l == XYZLayout)
Expand All @@ -489,28 +489,28 @@ IMATH_CONSTEXPR14 inline Euler<T>::Euler (T xi,
}

template <class T>
IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Matrix33<T>& M, typename Euler::Order p) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Matrix33<T>& M, typename Euler::Order p) IMATH_NOEXCEPT
{
setOrder (p);
extract (M);
}

template <class T>
IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Matrix44<T>& M, typename Euler::Order p) IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler<T>::Euler (const Matrix44<T>& M, typename Euler::Order p) IMATH_NOEXCEPT
{
setOrder (p);
extract (M);
}

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::extract (const Quat<T>& q) IMATH_NOEXCEPT
{
extract (q.toMatrix33());
}

template <class T>
void
IMATH_HOSTDEVICE void
Euler<T>::extract (const Matrix33<T>& M) IMATH_NOEXCEPT
{
int i, j, k;
Expand Down Expand Up @@ -617,7 +617,7 @@ Euler<T>::extract (const Matrix33<T>& M) IMATH_NOEXCEPT
}

template <class T>
void
IMATH_HOSTDEVICE void
Euler<T>::extract (const Matrix44<T>& M) IMATH_NOEXCEPT
{
int i, j, k;
Expand Down Expand Up @@ -694,7 +694,7 @@ Euler<T>::extract (const Matrix44<T>& M) IMATH_NOEXCEPT
}

template <class T>
Matrix33<T>
IMATH_HOSTDEVICE Matrix33<T>
Euler<T>::toMatrix33() const IMATH_NOEXCEPT
{
int i, j, k;
Expand Down Expand Up @@ -753,7 +753,7 @@ Euler<T>::toMatrix33() const IMATH_NOEXCEPT
}

template <class T>
Matrix44<T>
IMATH_HOSTDEVICE Matrix44<T>
Euler<T>::toMatrix44() const IMATH_NOEXCEPT
{
int i, j, k;
Expand Down Expand Up @@ -812,7 +812,7 @@ Euler<T>::toMatrix44() const IMATH_NOEXCEPT
}

template <class T>
Quat<T>
IMATH_HOSTDEVICE Quat<T>
Euler<T>::toQuat() const IMATH_NOEXCEPT
{
Vec3<T> angles;
Expand Down Expand Up @@ -867,14 +867,14 @@ Euler<T>::toQuat() const IMATH_NOEXCEPT
}

template <class T>
constexpr inline bool
IMATH_HOSTDEVICE constexpr inline bool
Euler<T>::legal (typename Euler<T>::Order order) IMATH_NOEXCEPT
{
return (order & ~Legal) ? false : true;
}

template <class T>
IMATH_CONSTEXPR14 typename Euler<T>::Order
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 typename Euler<T>::Order
Euler<T>::order() const IMATH_NOEXCEPT
{
int foo = (_initialAxis == Z ? 0x2000 : (_initialAxis == Y ? 0x1000 : 0));
Expand All @@ -890,7 +890,7 @@ Euler<T>::order() const IMATH_NOEXCEPT
}

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::setOrder (typename Euler<T>::Order p) IMATH_NOEXCEPT
{
set (p & 0x2000 ? Z : (p & 0x1000 ? Y : X), // initial axis
Expand All @@ -900,7 +900,7 @@ Euler<T>::setOrder (typename Euler<T>::Order p) IMATH_NOEXCEPT
}

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::set (typename Euler<T>::Axis axis, bool relative, bool parityEven, bool firstRepeats) IMATH_NOEXCEPT
{
_initialAxis = axis;
Expand All @@ -910,7 +910,7 @@ Euler<T>::set (typename Euler<T>::Axis axis, bool relative, bool parityEven, boo
}

template <class T>
IMATH_CONSTEXPR14 inline const Euler<T>&
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Euler<T>&
Euler<T>::operator= (const Euler<T>& euler) IMATH_NOEXCEPT
{
x = euler.x;
Expand All @@ -924,7 +924,7 @@ Euler<T>::operator= (const Euler<T>& euler) IMATH_NOEXCEPT
}

template <class T>
IMATH_CONSTEXPR14 inline const Euler<T>&
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Euler<T>&
Euler<T>::operator= (const Vec3<T>& v) IMATH_NOEXCEPT
{
x = v.x;
Expand All @@ -934,7 +934,7 @@ Euler<T>::operator= (const Vec3<T>& v) IMATH_NOEXCEPT
}

template <class T>
IMATH_CONSTEXPR14 inline float
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline float
Euler<T>::angleMod (T angle) IMATH_NOEXCEPT
{
const T pi = static_cast<T> (M_PI);
Expand All @@ -949,7 +949,7 @@ Euler<T>::angleMod (T angle) IMATH_NOEXCEPT
}

template <class T>
inline void
IMATH_HOSTDEVICE inline void
Euler<T>::simpleXYZRotation (Vec3<T>& xyzRot, const Vec3<T>& targetXyzRot) IMATH_NOEXCEPT
{
Vec3<T> d = xyzRot - targetXyzRot;
Expand All @@ -959,7 +959,7 @@ Euler<T>::simpleXYZRotation (Vec3<T>& xyzRot, const Vec3<T>& targetXyzRot) IMATH
}

template <class T>
void
IMATH_HOSTDEVICE void
Euler<T>::nearestRotation (Vec3<T>& xyzRot, const Vec3<T>& targetXyzRot, Order order) IMATH_NOEXCEPT
{
int i, j, k;
Expand Down Expand Up @@ -987,7 +987,7 @@ Euler<T>::nearestRotation (Vec3<T>& xyzRot, const Vec3<T>& targetXyzRot, Order o
}

template <class T>
void
IMATH_HOSTDEVICE void
Euler<T>::makeNear (const Euler<T>& target) IMATH_NOEXCEPT
{
Vec3<T> xyzRot = toXYZVector();
Expand Down
4 changes: 2 additions & 2 deletions src/Imath/ImathFun.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ IMATH_EXPORT double predd (double d) IMATH_NOEXCEPT;
// Return true if the number is not a NaN or Infinity.
//

inline bool IMATH_HOSTDEVICE
IMATH_HOSTDEVICE inline bool
finitef (float f) IMATH_NOEXCEPT
{
union
Expand All @@ -213,7 +213,7 @@ finitef (float f) IMATH_NOEXCEPT
return (u.i & 0x7f800000) != 0x7f800000;
}

inline bool IMATH_HOSTDEVICE
IMATH_HOSTDEVICE inline bool
finited (double d) IMATH_NOEXCEPT
{
union
Expand Down
Loading