Minor tweaks to simd codebase
This commit is contained in:
@@ -101,7 +101,7 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the far plane of the BoundingFrustum.
|
||||
/// Gets the far plane of the frustum.
|
||||
/// </summary>
|
||||
FORCE_INLINE Plane GetFar() const
|
||||
{
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the left plane of the BoundingFrustum.
|
||||
/// Gets the left plane of the frustum.
|
||||
/// </summary>
|
||||
FORCE_INLINE Plane GetLeft() const
|
||||
{
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the right plane of the BoundingFrustum.
|
||||
/// Gets the right plane of the frustum.
|
||||
/// </summary>
|
||||
FORCE_INLINE Plane GetRight() const
|
||||
{
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the top plane of the BoundingFrustum.
|
||||
/// Gets the top plane of the frustum.
|
||||
/// </summary>
|
||||
FORCE_INLINE Plane GetTop() const
|
||||
{
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the bottom plane of the BoundingFrustum.
|
||||
/// Gets the bottom plane of the frustum.
|
||||
/// </summary>
|
||||
FORCE_INLINE Plane GetBottom() const
|
||||
{
|
||||
@@ -230,17 +230,17 @@ public:
|
||||
ContainmentType Contains(const BoundingSphere& sphere) const;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the current BoundingFrustum intersects a BoundingSphere.
|
||||
/// Checks whether the current frustum intersects a sphere.
|
||||
/// </summary>
|
||||
/// <param name="sphere">The sphere.</param>
|
||||
/// <returns>True if the current BoundingFrustum intersects a BoundingSphere, otherwise false.</returns>
|
||||
/// <returns>True if the current frustum intersects a sphere, otherwise false.</returns>
|
||||
bool Intersects(const BoundingSphere& sphere) const;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the current BoundingFrustum intersects a BoundingBox.
|
||||
/// Checks whether the current frustum intersects a box.
|
||||
/// </summary>
|
||||
/// <param name="box">The box</param>
|
||||
/// <returns>True if the current BoundingFrustum intersects a BoundingBox, otherwise false.</returns>
|
||||
/// <returns>True if the current frustum intersects a box, otherwise false.</returns>
|
||||
FORCE_INLINE bool Intersects(const BoundingBox& box) const
|
||||
{
|
||||
return CollisionsHelper::FrustumContainsBox(*this, box) != ContainmentType::Disjoint;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#if PLATFORM_SIMD_SSE2
|
||||
|
||||
// Vector of four floating point values stored in vector register.
|
||||
// Vector of four floating point values stored in a vector register.
|
||||
typedef __m128 SimdVector4;
|
||||
|
||||
namespace SIMD
|
||||
@@ -28,9 +28,15 @@ namespace SIMD
|
||||
return _mm_set_ps(w, z, y, x);
|
||||
}
|
||||
|
||||
FORCE_INLINE SimdVector4 Load(const void* src)
|
||||
FORCE_INLINE SimdVector4 Load(const float* __restrict src)
|
||||
{
|
||||
return _mm_load_ps((const float*)(src));
|
||||
return _mm_loadu_ps(src);
|
||||
}
|
||||
|
||||
FORCE_INLINE SimdVector4 LoadAligned(const float* __restrict src)
|
||||
{
|
||||
ASSERT_LOW_LAYER(((uintptr)src & 15) == 0);
|
||||
return _mm_load_ps(src);
|
||||
}
|
||||
|
||||
FORCE_INLINE SimdVector4 Splat(float value)
|
||||
@@ -38,9 +44,15 @@ namespace SIMD
|
||||
return _mm_set_ps1(value);
|
||||
}
|
||||
|
||||
FORCE_INLINE void Store(void* dst, SimdVector4 src)
|
||||
FORCE_INLINE void Store(float* __restrict dst, SimdVector4 src)
|
||||
{
|
||||
_mm_store_ps((float*)dst, src);
|
||||
_mm_storeu_ps(dst, src);
|
||||
}
|
||||
|
||||
FORCE_INLINE void StoreAligned(float* __restrict dst, SimdVector4 src)
|
||||
{
|
||||
ASSERT_LOW_LAYER(((uintptr)dst & 15) == 0);
|
||||
_mm_store_ps(dst, src);
|
||||
}
|
||||
|
||||
FORCE_INLINE int MoveMask(SimdVector4 a)
|
||||
@@ -113,7 +125,12 @@ namespace SIMD
|
||||
return { x, y, z, w };
|
||||
}
|
||||
|
||||
FORCE_INLINE SimdVector4 Load(const void* src)
|
||||
FORCE_INLINE SimdVector4 Load(const float* __restrict src)
|
||||
{
|
||||
return *(const SimdVector4*)src;
|
||||
}
|
||||
|
||||
FORCE_INLINE SimdVector4 LoadAligned(const float* __restrict src)
|
||||
{
|
||||
return *(const SimdVector4*)src;
|
||||
}
|
||||
@@ -123,10 +140,15 @@ namespace SIMD
|
||||
return { value, value, value, value };
|
||||
}
|
||||
|
||||
FORCE_INLINE void Store(void* dst, SimdVector4 src)
|
||||
{
|
||||
FORCE_INLINE void Store(float* __restrict dst, SimdVector4 src)
|
||||
{
|
||||
(*(SimdVector4*)dst) = src;
|
||||
}
|
||||
}
|
||||
|
||||
FORCE_INLINE void StoreAligned(float* __restrict dst, SimdVector4 src)
|
||||
{
|
||||
(*(SimdVector4*)dst) = src;
|
||||
}
|
||||
|
||||
FORCE_INLINE int MoveMask(SimdVector4 a)
|
||||
{
|
||||
|
||||
@@ -228,6 +228,7 @@ API_ENUM() enum class ArchitectureType
|
||||
#if defined(_M_PPC) || defined(__CELLOS_LV2__)
|
||||
#define PLATFORM_SIMD_VMX 1
|
||||
#endif
|
||||
#define PLATFORM_SIMD (PLATFORM_SIMD_SSE2 || PLATFORM_SIMD_SSE3 || PLATFORM_SIMD_SSE4 || PLATFORM_SIMD_NEON || PLATFORM_SIMD_VMX)
|
||||
|
||||
// Unicode text macro
|
||||
#if !defined(TEXT)
|
||||
|
||||
Reference in New Issue
Block a user