From 6f67371bb1b46579ae837d0e0c61ac1b291be743 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 13 Jan 2018 07:51:33 +0500 Subject: Directory renamed --- .../include/glm/detail/func_geometric_simd.inl | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 external/include/glm/detail/func_geometric_simd.inl (limited to 'external/include/glm/detail/func_geometric_simd.inl') diff --git a/external/include/glm/detail/func_geometric_simd.inl b/external/include/glm/detail/func_geometric_simd.inl new file mode 100644 index 0000000..f0d14a2 --- /dev/null +++ b/external/include/glm/detail/func_geometric_simd.inl @@ -0,0 +1,99 @@ +/// @ref core +/// @file glm/detail/func_geometric_simd.inl + +#include "../simd/geometric.h" + +#if GLM_ARCH & GLM_ARCH_SSE2_BIT + +namespace glm{ +namespace detail +{ + template + struct compute_length + { + GLM_FUNC_QUALIFIER static float call(tvec4 const & v) + { + return _mm_cvtss_f32(glm_vec4_length(v.data)); + } + }; + + template + struct compute_distance + { + GLM_FUNC_QUALIFIER static float call(tvec4 const & p0, tvec4 const & p1) + { + return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data)); + } + }; + + template + struct compute_dot + { + GLM_FUNC_QUALIFIER static float call(tvec4 const& x, tvec4 const& y) + { + return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); + } + }; + + template + struct compute_cross + { + GLM_FUNC_QUALIFIER static tvec3 call(tvec3 const & a, tvec3 const & b) + { + __m128 const set0 = _mm_set_ps(0.0f, a.z, a.y, a.x); + __m128 const set1 = _mm_set_ps(0.0f, b.z, b.y, b.x); + __m128 const xpd0 = glm_vec4_cross(set0, set1); + + tvec4 result(uninitialize); + result.data = xpd0; + return tvec3(result); + } + }; + + template + struct compute_normalize + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_vec4_normalize(v.data); + return result; + } + }; + + template + struct compute_faceforward + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& N, tvec4 const& I, tvec4 const& Nref) + { + tvec4 result(uninitialize); + result.data = glm_vec4_faceforward(N.data, I.data, Nref.data); + return result; + } + }; + + template + struct compute_reflect + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& I, tvec4 const& N) + { + tvec4 result(uninitialize); + result.data = glm_vec4_reflect(I.data, N.data); + return result; + } + }; + + template + struct compute_refract + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& I, tvec4 const& N, float eta) + { + tvec4 result(uninitialize); + result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta)); + return result; + } + }; +}//namespace detail +}//namespace glm + +#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT -- cgit v1.2.3