Browse Source

Updated simd implementation

Christophe Riccio 15 years ago
parent
commit
b149eb626c
3 changed files with 48 additions and 1 deletions
  1. 12 0
      glm/gtx/simd_mat4.hpp
  2. 34 0
      glm/gtx/simd_mat4.inl
  3. 2 1
      glm/gtx/simd_vec4.inl

+ 12 - 0
glm/gtx/simd_mat4.hpp

@@ -125,6 +125,18 @@ namespace glm
 	{
 	{
 		typedef detail::fmat4x4SIMD simd_mat4;
 		typedef detail::fmat4x4SIMD simd_mat4;
 
 
+		//! Returns the transposed matrix of x
+		//! (From GLM_GTX_simd_mat4 extension).
+		detail::fmat4x4SIMD simd_transpose(detail::fmat4x4SIMD const & m);
+
+		//! Return the determinant of a mat4 matrix.
+		//! (From GLM_GTX_simd_mat4 extension).
+		float simd_determinant(detail::fmat4x4SIMD const & m);
+
+		//! Return the inverse of a mat4 matrix.
+		//! (From GLM_GTX_simd_mat4 extension).
+		detail::fmat4x4SIMD simd_inverse(detail::fmat4x4SIMD const & m);
+
 	}//namespace simd_mat4
 	}//namespace simd_mat4
 	}//namespace gtx
 	}//namespace gtx
 }//namespace glm
 }//namespace glm

+ 34 - 0
glm/gtx/simd_mat4.inl

@@ -218,4 +218,38 @@ namespace detail
     }
     }
 
 
 }//namespace detail
 }//namespace detail
+
+namespace gtx{
+namespace simd_mat4
+{
+	inline detail::fmat4x4SIMD matrixCompMult
+	(
+		detail::fmat4x4SIMD const & x,
+		detail::fmat4x4SIMD const & y
+	)
+	{
+		GLM_STATIC_ASSERT(0, "TODO");
+	}
+
+	inline detail::fmat4x4SIMD simd_transpose(detail::fmat4x4SIMD const & m)
+	{
+		detail::fmat4x4SIMD result;
+		_mm_transpose_ps(&m[0].Data, &result[0].Data);
+		return result;
+	}
+
+	inline float simd_determinant(detail::fmat4x4SIMD const & m)
+	{
+		GLM_STATIC_ASSERT(0, "TODO");
+	}
+
+	inline detail::fmat4x4SIMD simd_inverse(detail::fmat4x4SIMD const & m)
+	{
+		detail::fmat4x4SIMD result;
+		_mm_inverse_ps(&m[0].Data, &result[0].Data);
+		return result;
+	}
+}//namespace simd_mat4
+}//namespace gtx
+
 }//namespace glm
 }//namespace glm

+ 2 - 1
glm/gtx/simd_vec4.inl

@@ -163,7 +163,8 @@ namespace glm
 		template <comp a, comp b, comp c, comp d>
 		template <comp a, comp b, comp c, comp d>
 		inline fvec4SIMD& fvec4SIMD::swizzle()
 		inline fvec4SIMD& fvec4SIMD::swizzle()
 		{
 		{
-			this->Data = _mm_shuffle_ps(this->Data, this->Data, (((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0))));
+			enum{mask = (((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0)))};
+			this->Data = _mm_shuffle_ps(this->Data, this->Data, mask);
 			return *this;
 			return *this;
 		}
 		}