From a53acffaf4a7841cf1d371d7217bfda9b6ebf441 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 8 Feb 2011 12:31:20 +0000 Subject: [PATCH] Completed SQRT SIMD implementations --- glm/gtx/simd_vec4.hpp | 7 ++++++- glm/gtx/simd_vec4.inl | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 028db5e0..aaf4874d 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -407,7 +407,12 @@ namespace glm detail::fvec4SIMD simdSqrt( 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) detail::fvec4SIMD simdFastSqrt( detail::fvec4SIMD const & x); diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index f74144b8..67613d8e 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -635,13 +635,18 @@ namespace glm } 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); } 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