From e62817b8252974b8a98393275874ee303840bf13 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 12 May 2017 18:49:50 +0500 Subject: 2017-05-12 --- .../include/glm/detail/func_matrix_simd.inl | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 depedencies/include/glm/detail/func_matrix_simd.inl (limited to 'depedencies/include/glm/detail/func_matrix_simd.inl') diff --git a/depedencies/include/glm/detail/func_matrix_simd.inl b/depedencies/include/glm/detail/func_matrix_simd.inl new file mode 100644 index 0000000..61b0a5b --- /dev/null +++ b/depedencies/include/glm/detail/func_matrix_simd.inl @@ -0,0 +1,88 @@ +/// @ref core +/// @file glm/detail/func_matrix_simd.inl + +#if GLM_ARCH & GLM_ARCH_SSE2_BIT + +#include "type_mat4x4.hpp" +#include "func_geometric.hpp" +#include "../simd/matrix.h" + +namespace glm{ +namespace detail +{ + template + struct compute_matrixCompMult + { + GLM_STATIC_ASSERT(detail::is_aligned

::value, "Specialization requires aligned"); + + GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const & x, tmat4x4 const & y) + { + tmat4x4 result(uninitialize); + glm_mat4_matrixCompMult( + *(glm_vec4 const (*)[4])&x[0].data, + *(glm_vec4 const (*)[4])&y[0].data, + *(glm_vec4(*)[4])&result[0].data); + return result; + } + }; + + template + struct compute_transpose + { + GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const & m) + { + tmat4x4 result(uninitialize); + glm_mat4_transpose( + *(glm_vec4 const (*)[4])&m[0].data, + *(glm_vec4(*)[4])&result[0].data); + return result; + } + }; + + template + struct compute_determinant + { + GLM_FUNC_QUALIFIER static float call(tmat4x4 const& m) + { + return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data))); + } + }; + + template + struct compute_inverse + { + GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const& m) + { + tmat4x4 Result(uninitialize); + glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data)); + return Result; + } + }; +}//namespace detail + + template<> + GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) + { + tmat4x4 m(uninitialize); + glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); + return m; + } + + template<> + GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) + { + tmat4x4 m(uninitialize); + glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); + return m; + } + + template<> + GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) + { + tmat4x4 m(uninitialize); + glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); + return m; + } +}//namespace glm + +#endif -- cgit v1.2.3