summaryrefslogtreecommitdiffstats
path: root/depedencies/include/glm/detail/func_geometric_simd.inl
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-05-12 15:49:50 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-05-12 15:49:50 +0200
commite62817b8252974b8a98393275874ee303840bf13 (patch)
tree4565935f06e369f4a84410b0c098958e07a750c7 /depedencies/include/glm/detail/func_geometric_simd.inl
parent2017-05-10 (diff)
downloadAltCraft-e62817b8252974b8a98393275874ee303840bf13.tar
AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.gz
AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.bz2
AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.lz
AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.xz
AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.zst
AltCraft-e62817b8252974b8a98393275874ee303840bf13.zip
Diffstat (limited to 'depedencies/include/glm/detail/func_geometric_simd.inl')
-rw-r--r--depedencies/include/glm/detail/func_geometric_simd.inl99
1 files changed, 99 insertions, 0 deletions
diff --git a/depedencies/include/glm/detail/func_geometric_simd.inl b/depedencies/include/glm/detail/func_geometric_simd.inl
new file mode 100644
index 0000000..f0d14a2
--- /dev/null
+++ b/depedencies/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 <precision P>
+ struct compute_length<tvec4, float, P, true>
+ {
+ GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & v)
+ {
+ return _mm_cvtss_f32(glm_vec4_length(v.data));
+ }
+ };
+
+ template <precision P>
+ struct compute_distance<tvec4, float, P, true>
+ {
+ GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & p0, tvec4<float, P> const & p1)
+ {
+ return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data));
+ }
+ };
+
+ template <precision P>
+ struct compute_dot<tvec4, float, P, true>
+ {
+ GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const& x, tvec4<float, P> const& y)
+ {
+ return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
+ }
+ };
+
+ template <precision P>
+ struct compute_cross<float, P, true>
+ {
+ GLM_FUNC_QUALIFIER static tvec3<float, P> call(tvec3<float, P> const & a, tvec3<float, P> 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<float, P> result(uninitialize);
+ result.data = xpd0;
+ return tvec3<float, P>(result);
+ }
+ };
+
+ template <precision P>
+ struct compute_normalize<float, P, tvec4, true>
+ {
+ GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
+ {
+ tvec4<float, P> result(uninitialize);
+ result.data = glm_vec4_normalize(v.data);
+ return result;
+ }
+ };
+
+ template <precision P>
+ struct compute_faceforward<float, P, tvec4, true>
+ {
+ GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& N, tvec4<float, P> const& I, tvec4<float, P> const& Nref)
+ {
+ tvec4<float, P> result(uninitialize);
+ result.data = glm_vec4_faceforward(N.data, I.data, Nref.data);
+ return result;
+ }
+ };
+
+ template <precision P>
+ struct compute_reflect<float, P, tvec4, true>
+ {
+ GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N)
+ {
+ tvec4<float, P> result(uninitialize);
+ result.data = glm_vec4_reflect(I.data, N.data);
+ return result;
+ }
+ };
+
+ template <precision P>
+ struct compute_refract<float, P, tvec4, true>
+ {
+ GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N, float eta)
+ {
+ tvec4<float, P> 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