1/// @ref core 2/// @file glm/detail/func_matrix_simd.inl 3 4#if GLM_ARCH & GLM_ARCH_SSE2_BIT 5 6#include "type_mat4x4.hpp" 7#include "func_geometric.hpp" 8#include "../simd/matrix.h" 9 10namespace glm{ 11namespace detail 12{ 13 template <precision P> 14 struct compute_matrixCompMult<tmat4x4, float, P, true> 15 { 16 GLM_STATIC_ASSERT(detail::is_aligned<P>::value, "Specialization requires aligned"); 17 18 GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & x, tmat4x4<float, P> const & y) 19 { 20 tmat4x4<float, P> result(uninitialize); 21 glm_mat4_matrixCompMult( 22 *(glm_vec4 const (*)[4])&x[0].data, 23 *(glm_vec4 const (*)[4])&y[0].data, 24 *(glm_vec4(*)[4])&result[0].data); 25 return result; 26 } 27 }; 28 29 template <precision P> 30 struct compute_transpose<tmat4x4, float, P, true> 31 { 32 GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & m) 33 { 34 tmat4x4<float, P> result(uninitialize); 35 glm_mat4_transpose( 36 *(glm_vec4 const (*)[4])&m[0].data, 37 *(glm_vec4(*)[4])&result[0].data); 38 return result; 39 } 40 }; 41 42 template <precision P> 43 struct compute_determinant<tmat4x4, float, P, true> 44 { 45 GLM_FUNC_QUALIFIER static float call(tmat4x4<float, P> const& m) 46 { 47 return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data))); 48 } 49 }; 50 51 template <precision P> 52 struct compute_inverse<tmat4x4, float, P, true> 53 { 54 GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const& m) 55 { 56 tmat4x4<float, P> Result(uninitialize); 57 glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data)); 58 return Result; 59 } 60 }; 61}//namespace detail 62 63 template<> 64 GLM_FUNC_QUALIFIER tmat4x4<float, aligned_lowp> outerProduct<float, aligned_lowp, tvec4, tvec4>(tvec4<float, aligned_lowp> const & c, tvec4<float, aligned_lowp> const & r) 65 { 66 tmat4x4<float, aligned_lowp> m(uninitialize); 67 glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); 68 return m; 69 } 70 71 template<> 72 GLM_FUNC_QUALIFIER tmat4x4<float, aligned_mediump> outerProduct<float, aligned_mediump, tvec4, tvec4>(tvec4<float, aligned_mediump> const & c, tvec4<float, aligned_mediump> const & r) 73 { 74 tmat4x4<float, aligned_mediump> m(uninitialize); 75 glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); 76 return m; 77 } 78 79 template<> 80 GLM_FUNC_QUALIFIER tmat4x4<float, aligned_highp> outerProduct<float, aligned_highp, tvec4, tvec4>(tvec4<float, aligned_highp> const & c, tvec4<float, aligned_highp> const & r) 81 { 82 tmat4x4<float, aligned_highp> m(uninitialize); 83 glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); 84 return m; 85 } 86}//namespace glm 87 88#endif 89