Explorar o código

Completed SQRT SIMD implementations

Christophe Riccio %!s(int64=15) %!d(string=hai) anos
pai
achega
a53acffaf4
Modificáronse 2 ficheiros con 12 adicións e 2 borrados
  1. 6 1
      glm/gtx/simd_vec4.hpp
  2. 6 1
      glm/gtx/simd_vec4.inl

+ 6 - 1
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);

+ 6 - 1
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