Răsfoiți Sursa

Updated SSE setup

Christophe Riccio 15 ani în urmă
părinte
comite
d7755485c8
4 a modificat fișierele cu 37 adăugiri și 9 ștergeri
  1. 3 4
      glm/core/intrinsic_common.hpp
  2. 4 0
      glm/gtx/simd_vec4.hpp
  3. 19 2
      glm/gtx/simd_vec4.inl
  4. 11 3
      glm/setup.hpp

+ 3 - 4
glm/core/intrinsic_common.hpp

@@ -12,11 +12,10 @@
 
 #include "../setup.hpp"
 
-#if(GLM_ARCH != GLM_ARCH_PURE)
+#if(GLM_ARCH >= GLM_ARCH_SSE2)
 
 namespace glm{
-namespace detail
-{
+namespace detail{
 	__m128 sse_abs_ps(__m128 x);
 
 	__m128 sse_sgn_ps(__m128 x);
@@ -62,5 +61,5 @@ namespace detail
 
 #include "intrinsic_common.inl"
 
-#endif//(GLM_ARCH != GLM_ARCH_PURE)
+#endif//(GLM_ARCH >= GLM_ARCH_SSE2)
 #endif//glm_detail_intrinsic_common

+ 4 - 0
glm/gtx/simd_vec4.hpp

@@ -110,6 +110,10 @@ namespace glm
 	{
 		typedef detail::fvec4SIMD simd_vec4;
 
+		detail::fvec4SIMD cross(
+			detail::fvec4SIMD const & a,
+			detail::fvec4SIMD const & b);
+
 	}//namespace simd_vec4
 	}//namespace gtx
 }//namespace glm

+ 19 - 2
glm/gtx/simd_vec4.inl

@@ -266,8 +266,25 @@ namespace glm
 	namespace gtx{
 	namespace simd_vec4
 	{
-		
-
+#		if(GLM_INSTRUCTION_SET & GLM_INSTRUCTION_SET_SSE)
+			inline detail::fvec4SIMD cross
+			(
+				detail::fvec4SIMD const & a,
+				detail::fvec4SIMD const & b
+			)
+			{
+				return _mm_xpd_ps(a.Data, b.Data);
+			}
+#		else//(GLM_INSTRUCTION_SET & GLM_INSTRUCTION_SET_PURE)
+			inline detail::fvec4SIMD cross
+			(
+				detail::fvec4SIMD const & a,
+				detail::fvec4SIMD const & b
+			)
+			{
+				return glm::cross(a, b);
+			}
+#		endif
 	}//namespace simd_vec4
 	}//namespace gtx
 }//namespace glm

+ 11 - 3
glm/setup.hpp

@@ -241,10 +241,18 @@
 #if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC)) 
 #	define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_NULL
 #elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) 
-#	ifdef _M_CEE_PURE
-#		define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE
+#	if(GLM_MODEL == GLM_MODEL_64)
+#		ifdef _M_CEE_PURE
+#			define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE
+#		else
+#			define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_MMX | GLM_INSTRUCTION_SET_SSE
+#		endif
 #	else
-#		define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_NULL
+#		ifdef _M_CEE_PURE
+#			define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE
+#		else
+#			define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_NULL
+#		endif
 #	endif
 #else
 #	define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE