Completed SQRT SIMD implementations

This commit is contained in:
Christophe Riccio 2011-02-08 12:31:20 +00:00
parent c07a33334b
commit a53acffaf4
2 changed files with 12 additions and 2 deletions

View File

@ -407,7 +407,12 @@ namespace glm
detail::fvec4SIMD simdSqrt( detail::fvec4SIMD simdSqrt(
detail::fvec4SIMD const & x); detail::fvec4SIMD const & x);
//! Returns the positive square root of x with an accuracy slight lower or equal than simdSqrt but much faster. //! Returns the positive square root of x with the nicest quality but very slow
//! (From GLM_GTX_simd_vec4 extension, exponential function)
detail::fvec4SIMD simdNiceSqrt(
detail::fvec4SIMD const & x);
//! Returns the positive square root of x but less accurate than simdSqrt but much faster.
//! (From GLM_GTX_simd_vec4 extension, exponential function) //! (From GLM_GTX_simd_vec4 extension, exponential function)
detail::fvec4SIMD simdFastSqrt( detail::fvec4SIMD simdFastSqrt(
detail::fvec4SIMD const & x); detail::fvec4SIMD const & x);

View File

@ -635,13 +635,18 @@ namespace glm
} }
inline detail::fvec4SIMD simdSqrt(detail::fvec4SIMD const & x) inline detail::fvec4SIMD simdSqrt(detail::fvec4SIMD const & x)
{
return _mm_mul_ps(simdInversesqrt(x.Data), x.Data);
}
inline detail::fvec4SIMD simdNiceSqrt(detail::fvec4SIMD const & x)
{ {
return _mm_sqrt_ps(x.Data); return _mm_sqrt_ps(x.Data);
} }
inline detail::fvec4SIMD simdFastSqrt(detail::fvec4SIMD const & x) inline detail::fvec4SIMD simdFastSqrt(detail::fvec4SIMD const & x)
{ {
return _mm_mul_ps(simdFastInversesqrt(x.Data), x.Data);
} }
// SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration // SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration