From 2877f4eda3d1b0c7431039e3142ecf1a282a34b1 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 21 Aug 2018 20:40:38 +0500 Subject: Update glm to 0.9.9.0 --- external/include/glm/detail/func_matrix_simd.inl | 79 +++++++++++++----------- 1 file changed, 43 insertions(+), 36 deletions(-) (limited to 'external/include/glm/detail/func_matrix_simd.inl') diff --git a/external/include/glm/detail/func_matrix_simd.inl b/external/include/glm/detail/func_matrix_simd.inl index 61b0a5b..b96c028 100644 --- a/external/include/glm/detail/func_matrix_simd.inl +++ b/external/include/glm/detail/func_matrix_simd.inl @@ -4,56 +4,57 @@ #if GLM_ARCH & GLM_ARCH_SSE2_BIT #include "type_mat4x4.hpp" -#include "func_geometric.hpp" +#include "../geometric.hpp" #include "../simd/matrix.h" +#include namespace glm{ namespace detail { - template - struct compute_matrixCompMult + template + struct compute_matrixCompMult<4, 4, float, Q, true> { - GLM_STATIC_ASSERT(detail::is_aligned

::value, "Specialization requires aligned"); + GLM_STATIC_ASSERT(detail::is_aligned::value, "Specialization requires aligned"); - GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const & x, tmat4x4 const & y) + GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& x, mat<4, 4, float, Q> const& y) { - tmat4x4 result(uninitialize); + mat<4, 4, float, Q> Result; 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; + *static_cast(&x[0].data), + *static_cast(&y[0].data), + *static_cast(&Result[0].data)); + return Result; } }; - template - struct compute_transpose + template + struct compute_transpose<4, 4, float, Q, true> { - GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const & m) + GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m) { - tmat4x4 result(uninitialize); + mat<4, 4, float, Q> Result; glm_mat4_transpose( - *(glm_vec4 const (*)[4])&m[0].data, - *(glm_vec4(*)[4])&result[0].data); - return result; + *static_cast(&m[0].data), + *static_cast(&Result[0].data)); + return Result; } }; - template - struct compute_determinant + template + struct compute_determinant<4, 4, float, Q, true> { - GLM_FUNC_QUALIFIER static float call(tmat4x4 const& m) + GLM_FUNC_QUALIFIER static float call(mat<4, 4, float, Q> const& m) { return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data))); } }; - template - struct compute_inverse + template + struct compute_inverse<4, 4, float, Q, true> { - GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const& m) + GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m) { - tmat4x4 Result(uninitialize); + mat<4, 4, float, Q> Result; glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data)); return Result; } @@ -61,27 +62,33 @@ namespace detail }//namespace detail template<> - GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) + GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_lowp> outerProduct<4, 4, float, aligned_lowp>(vec<4, float, aligned_lowp> const& c, vec<4, float, aligned_lowp> const& r) { - tmat4x4 m(uninitialize); - glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); - return m; + __m128 NativeResult[4]; + glm_mat4_outerProduct(c.data, r.data, NativeResult); + mat<4, 4, float, aligned_lowp> Result; + std::memcpy(&Result[0], &NativeResult[0], sizeof(Result)); + return Result; } template<> - GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) + GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_mediump> outerProduct<4, 4, float, aligned_mediump>(vec<4, float, aligned_mediump> const& c, vec<4, float, aligned_mediump> const& r) { - tmat4x4 m(uninitialize); - glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); - return m; + __m128 NativeResult[4]; + glm_mat4_outerProduct(c.data, r.data, NativeResult); + mat<4, 4, float, aligned_mediump> Result; + std::memcpy(&Result[0], &NativeResult[0], sizeof(Result)); + return Result; } template<> - GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) + GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_highp> outerProduct<4, 4, float, aligned_highp>(vec<4, float, aligned_highp> const& c, vec<4, float, aligned_highp> const& r) { - tmat4x4 m(uninitialize); - glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); - return m; + __m128 NativeResult[4]; + glm_mat4_outerProduct(c.data, r.data, NativeResult); + mat<4, 4, float, aligned_highp> Result; + std::memcpy(&Result[0], &NativeResult[0], sizeof(Result)); + return Result; } }//namespace glm -- cgit v1.2.3