From 8bcf9b5ae791fce37a86764b8acfd68424ac544b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 16 Aug 2017 03:09:04 +0200 Subject: [PATCH] Fixed SIMD build --- glm/detail/func_common_simd.inl | 108 +++++++++++++-------------- glm/detail/func_exponential_simd.inl | 4 +- glm/detail/func_geometric_simd.inl | 36 ++++----- glm/detail/func_integer_simd.inl | 12 +-- glm/detail/func_matrix_simd.inl | 20 ++--- 5 files changed, 90 insertions(+), 90 deletions(-) diff --git a/glm/detail/func_common_simd.inl b/glm/detail/func_common_simd.inl index 9c2d820e..a3482ff4 100644 --- a/glm/detail/func_common_simd.inl +++ b/glm/detail/func_common_simd.inl @@ -11,11 +11,11 @@ namespace glm{ namespace detail { template - struct compute_abs_vector<4, float, P, true> + struct compute_abs_vector<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = glm_vec4_abs(v.data); return result; } @@ -33,168 +33,168 @@ namespace detail }; template - struct compute_floor<4, float, P, true> + struct compute_floor<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = glm_vec4_floor(v.data); return result; } }; template - struct compute_ceil<4, float, P, true> + struct compute_ceil<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = glm_vec4_ceil(v.data); return result; } }; template - struct compute_fract<4, float, P, true> + struct compute_fract<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = glm_vec4_fract(v.data); return result; } }; template - struct compute_round<4, float, P, true> + struct compute_round<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = glm_vec4_round(v.data); return result; } }; template - struct compute_mod<4, float, P, true> + struct compute_mod<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = glm_vec4_mod(x.data, y.data); return result; } }; template - struct compute_min_vector<4, float, P, true> + struct compute_min_vector<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = _mm_min_ps(v1.data, v2.data); return result; } }; template - struct compute_min_vector<4, int32, P, true> + struct compute_min_vector<4, int32, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) { - vec<4, int32, P> result; + vec<4, int32, Q> result; result.data = _mm_min_epi32(v1.data, v2.data); return result; } }; template - struct compute_min_vector<4, uint32, P, true> + struct compute_min_vector<4, uint32, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2) { - vec<4, uint32, P> result; + vec<4, uint32, Q> result; result.data = _mm_min_epu32(v1.data, v2.data); return result; } }; template - struct compute_max_vector<4, float, P, true> + struct compute_max_vector<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = _mm_max_ps(v1.data, v2.data); return result; } }; template - struct compute_max_vector<4, int32, P, true> + struct compute_max_vector<4, int32, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) { - vec<4, int32, P> result; + vec<4, int32, Q> result; result.data = _mm_max_epi32(v1.data, v2.data); return result; } }; template - struct compute_max_vector<4, uint32, P, true> + struct compute_max_vector<4, uint32, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2) { - vec<4, uint32, P> result; + vec<4, uint32, Q> result; result.data = _mm_max_epu32(v1.data, v2.data); return result; } }; template - struct compute_clamp_vector<4, float, P, true> + struct compute_clamp_vector<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& x, vec<4, float, Q> const& minVal, vec<4, float, Q> const& maxVal) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& x, vec<4, float, Q> const& minVal, vec<4, float, Q> const& maxVal) { - vec<4, float, P> result; + vec<4, float, Q> result; result.data = _mm_min_ps(_mm_max_ps(x.data, minVal.data), maxVal.data); return result; } }; template - struct compute_clamp_vector<4, int32, P, true> + struct compute_clamp_vector<4, int32, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, int32, Q> const& x, vec<4, int32, Q> const& minVal, vec<4, int32, Q> const& maxVal) + GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& x, vec<4, int32, Q> const& minVal, vec<4, int32, Q> const& maxVal) { - vec<4, int32, P> result; + vec<4, int32, Q> result; result.data = _mm_min_epi32(_mm_max_epi32(x.data, minVal.data), maxVal.data); return result; } }; template - struct compute_clamp_vector<4, uint32, P, true> + struct compute_clamp_vector<4, uint32, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& x, vec<4, uint32, Q> const& minVal, vec<4, uint32, Q> const& maxVal) + GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& x, vec<4, uint32, Q> const& minVal, vec<4, uint32, Q> const& maxVal) { - vec<4, uint32, P> result; + vec<4, uint32, Q> result; result.data = _mm_min_epu32(_mm_max_epu32(x.data, minVal.data), maxVal.data); return result; } }; template - struct compute_mix_vector<4, float, bool, P, true> + struct compute_mix_vector<4, float, bool, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y, vec<4, bool, Q> const& a) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y, vec<4, bool, Q> const& a) { __m128i const Load = _mm_set_epi32(-static_cast(a.w), -static_cast(a.z), -static_cast(a.y), -static_cast(a.x)); __m128 const Mask = _mm_castsi128_ps(Load); - vec<4, float, P> Result; + vec<4, float, Q> Result; # if 0 && GLM_ARCH & GLM_ARCH_AVX Result.data = _mm_blendv_ps(x.data, y.data, Mask); # else @@ -205,22 +205,22 @@ namespace detail }; /* FIXME template - struct compute_step_vector + struct compute_step_vector { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& edge, vec<4, float, Q> const& x) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& edge, vec<4, float, Q> const& x) { - vec<4, float, P> Result; + vec<4, float, Q> Result; result.data = glm_vec4_step(edge.data, x.data); return result; } }; */ template - struct compute_smoothstep_vector<4, float, P, true> + struct compute_smoothstep_vector<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& edge0, vec<4, float, Q> const& edge1, vec<4, float, Q> const& x) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& edge0, vec<4, float, Q> const& edge1, vec<4, float, Q> const& x) { - vec<4, float, P> Result; + vec<4, float, Q> Result; Result.data = glm_vec4_smoothstep(edge0.data, edge1.data, x.data); return Result; } diff --git a/glm/detail/func_exponential_simd.inl b/glm/detail/func_exponential_simd.inl index 6fb164fe..fdc5c0df 100644 --- a/glm/detail/func_exponential_simd.inl +++ b/glm/detail/func_exponential_simd.inl @@ -9,9 +9,9 @@ namespace glm{ namespace detail { template - struct compute_sqrt<4, float, P, true> + struct compute_sqrt<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { vec<4, float, P> Result; Result.data = _mm_sqrt_ps(v.data); diff --git a/glm/detail/func_geometric_simd.inl b/glm/detail/func_geometric_simd.inl index b6194651..e6c8d85f 100644 --- a/glm/detail/func_geometric_simd.inl +++ b/glm/detail/func_geometric_simd.inl @@ -9,7 +9,7 @@ namespace glm{ namespace detail { template - struct compute_length<4, float, P, true> + struct compute_length<4, float, Q, true> { GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& v) { @@ -18,7 +18,7 @@ namespace detail }; template - struct compute_distance<4, float, P, true> + struct compute_distance<4, float, Q, true> { GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& p0, vec<4, float, Q> const& p1) { @@ -27,7 +27,7 @@ namespace detail }; template - struct compute_dot, float, true> + struct compute_dot, float, true> { GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& x, vec<4, float, Q> const& y) { @@ -36,59 +36,59 @@ namespace detail }; template - struct compute_cross + struct compute_cross { - GLM_FUNC_QUALIFIER static vec<3, float, P> call(vec<3, float, Q> const& a, vec<3, float, Q> const& b) + GLM_FUNC_QUALIFIER static vec<3, float, Q> call(vec<3, float, Q> const& a, vec<3, float, Q> 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); - vec<4, float, P> Result; + vec<4, float, Q> Result; Result.data = xpd0; return vec<3, float, Q>(Result); } }; template - struct compute_normalize<4, float, P, true> + struct compute_normalize<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) { - vec<4, float, P> Result; + vec<4, float, Q> Result; Result.data = glm_vec4_normalize(v.data); return Result; } }; template - struct compute_faceforward<4, float, P, true> + struct compute_faceforward<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& N, vec<4, float, Q> const& I, vec<4, float, Q> const& Nref) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& N, vec<4, float, Q> const& I, vec<4, float, Q> const& Nref) { - vec<4, float, P> Result; + vec<4, float, Q> Result; Result.data = glm_vec4_faceforward(N.data, I.data, Nref.data); return Result; } }; template - struct compute_reflect<4, float, P, true> + struct compute_reflect<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N) { - vec<4, float, P> Result; + vec<4, float, Q> Result; Result.data = glm_vec4_reflect(I.data, N.data); return Result; } }; template - struct compute_refract<4, float, P, true> + struct compute_refract<4, float, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N, float eta) + GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N, float eta) { - vec<4, float, P> Result; + vec<4, float, Q> Result; Result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta)); return Result; } diff --git a/glm/detail/func_integer_simd.inl b/glm/detail/func_integer_simd.inl index 9259f52d..b1024f72 100644 --- a/glm/detail/func_integer_simd.inl +++ b/glm/detail/func_integer_simd.inl @@ -8,10 +8,10 @@ namespace glm{ namespace detail { - template - struct compute_bitfieldReverseStep<4, uint32, P, true, true> + template + struct compute_bitfieldReverseStep<4, uint32, Q, true, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) + GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) { __m128i const set0 = v.data; @@ -29,10 +29,10 @@ namespace detail } }; - template - struct compute_bitfieldBitCountStep<4, uint32, P, true, true> + template + struct compute_bitfieldBitCountStep<4, uint32, Q, true, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) + GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) { __m128i const set0 = v.data; diff --git a/glm/detail/func_matrix_simd.inl b/glm/detail/func_matrix_simd.inl index a4a3d6d3..f09c11fe 100644 --- a/glm/detail/func_matrix_simd.inl +++ b/glm/detail/func_matrix_simd.inl @@ -12,13 +12,13 @@ namespace glm{ namespace detail { template - struct compute_matrixCompMult + struct compute_matrixCompMult { GLM_STATIC_ASSERT(detail::is_aligned

::value, "Specialization requires aligned"); - GLM_FUNC_QUALIFIER static mat<4, 4, float, P> call(mat<4, 4, float, Q> const& x, mat<4, 4, float, Q> 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) { - mat<4, 4, float, P> Result; + mat<4, 4, float, Q> Result; glm_mat4_matrixCompMult( *static_cast(&x[0].data), *static_cast(&y[0].data), @@ -28,11 +28,11 @@ namespace detail }; template - struct compute_transpose + struct compute_transpose { - GLM_FUNC_QUALIFIER static mat<4, 4, float, P> call(mat<4, 4, float, Q> const& m) + GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m) { - mat<4, 4, float, P> Result; + mat<4, 4, float, Q> Result; glm_mat4_transpose( *static_cast(&m[0].data), *static_cast(&Result[0].data)); @@ -41,7 +41,7 @@ namespace detail }; template - struct compute_determinant + struct compute_determinant { GLM_FUNC_QUALIFIER static float call(mat<4, 4, float, Q> const& m) { @@ -50,11 +50,11 @@ namespace detail }; template - struct compute_inverse + struct compute_inverse { - GLM_FUNC_QUALIFIER static mat<4, 4, float, P> call(mat<4, 4, float, Q> const& m) + GLM_FUNC_QUALIFIER static mat<4, 4, float, Q> call(mat<4, 4, float, Q> const& m) { - mat<4, 4, float, P> Result; + 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; }