|
|
|
@ -1,6 +1,8 @@ |
|
|
|
|
/// @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" |
|
|
|
@ -8,17 +10,77 @@ |
|
|
|
|
namespace glm{ |
|
|
|
|
namespace detail |
|
|
|
|
{ |
|
|
|
|
# if GLM_ARCH & GLM_ARCH_SSE2_BIT |
|
|
|
|
template <precision P> |
|
|
|
|
struct compute_inverse<tmat4x4, float, P> |
|
|
|
|
template <precision P> |
|
|
|
|
struct compute_matrixCompMult<tmat4x4, float, P> |
|
|
|
|
{ |
|
|
|
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & x, tmat4x4<float, P> const & y) |
|
|
|
|
{ |
|
|
|
|
tmat4x4<float, P> 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 <precision P> |
|
|
|
|
struct compute_transpose<tmat4x4, float, P> |
|
|
|
|
{ |
|
|
|
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & m) |
|
|
|
|
{ |
|
|
|
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const& m) |
|
|
|
|
{ |
|
|
|
|
tmat4x4<float, P> Result(uninitialize); |
|
|
|
|
glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data)); |
|
|
|
|
return Result; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
# endif |
|
|
|
|
tmat4x4<float, P> result(uninitialize); |
|
|
|
|
glm_mat4_transpose( |
|
|
|
|
*(glm_vec4 const (*)[4])&m[0].data, |
|
|
|
|
*(glm_vec4(*)[4])&result[0].data); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template <precision P> |
|
|
|
|
struct compute_determinant<tmat4x4, float, P> |
|
|
|
|
{ |
|
|
|
|
GLM_FUNC_QUALIFIER static float call(tmat4x4<float, P> const& m) |
|
|
|
|
{ |
|
|
|
|
return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data))); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template <precision P> |
|
|
|
|
struct compute_inverse<tmat4x4, float, P> |
|
|
|
|
{ |
|
|
|
|
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const& m) |
|
|
|
|
{ |
|
|
|
|
tmat4x4<float, P> 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<float, lowp> outerProduct<float, lowp, tvec4, tvec4>(tvec4<float, lowp> const & c, tvec4<float, lowp> const & r) |
|
|
|
|
{ |
|
|
|
|
tmat4x4<float, lowp> m(uninitialize); |
|
|
|
|
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); |
|
|
|
|
return m; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
|
GLM_FUNC_QUALIFIER tmat4x4<float, mediump> outerProduct<float, mediump, tvec4, tvec4>(tvec4<float, mediump> const & c, tvec4<float, mediump> const & r) |
|
|
|
|
{ |
|
|
|
|
tmat4x4<float, mediump> m(uninitialize); |
|
|
|
|
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); |
|
|
|
|
return m; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
|
GLM_FUNC_QUALIFIER tmat4x4<float, highp> outerProduct<float, highp, tvec4, tvec4>(tvec4<float, highp> const & c, tvec4<float, highp> const & r) |
|
|
|
|
{ |
|
|
|
|
tmat4x4<float, highp> m(uninitialize); |
|
|
|
|
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); |
|
|
|
|
return m; |
|
|
|
|
} |
|
|
|
|
}//namespace glm |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|