diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index b4ea3bbe..9bcd8b8b 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -484,20 +484,6 @@ namespace detail template GLM_FUNC_DECL tvec4 operator||(tvec4 const & v1, tvec4 const & v2); - -/* -namespace detail -{ - template - struct _swizzle_base1<4, float, P, glm::tvec4, E0,E1,E2,E3> : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER tvec4 operator ()() const - { - return tvec4(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); - } - }; -}//namespace detail -*/ }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index 175797bf..8abefabb 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -6,6 +6,51 @@ namespace glm{ namespace detail { +# ifdef GLM_SWIZZLE + template + struct _swizzle_base1<4, float, P, glm::tvec4, E0,E1,E2,E3> : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER tvec4 operator ()() const + { + __m128 data = *reinterpret_cast<__m128 const*>(&this->_buffer); + + tvec4 Result(uninitialize); +# if GLM_ARCH & GLM_ARCH_AVX_BIT + Result.data = _mm_permute_ps(data, _MM_SHUFFLE(E3, E2, E1, E0)); +# else + Result.data = _mm_shuffle_ps(data, data, _MM_SHUFFLE(E3, E2, E1, E0)); +# endif + return Result; + } + }; + + template + struct _swizzle_base1<4, int32, P, glm::tvec4, E0,E1,E2,E3> : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER tvec4 operator ()() const + { + __m128i data = *reinterpret_cast<__m128i const*>(&this->_buffer); + + tvec4 Result(uninitialize); + Result.data = _mm_shuffle_epi32(data, _MM_SHUFFLE(E3, E2, E1, E0)); + return Result; + } + }; + + template + struct _swizzle_base1<4, uint32, P, glm::tvec4, E0,E1,E2,E3> : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER tvec4 operator ()() const + { + __m128i data = *reinterpret_cast<__m128i const*>(&this->_buffer); + + tvec4 Result(uninitialize); + Result.data = _mm_shuffle_epi32(data, _MM_SHUFFLE(E3, E2, E1, E0)); + return Result; + } + }; +# endif + template struct compute_vec4_add { diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 152b5c8f..920fedb0 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1243,11 +1243,13 @@ int main() glm::int32 const c(1); glm::int32 const d = ~c; +# if GLM_ARCH & GLM_ARCH_AVX_BIT glm_vec4 const A = _mm_set_ps(4, 3, 2, 1); glm_vec4 const B = glm_vec4_swizzle_xyzw(A); glm_vec4 const C = _mm_permute_ps(A, _MM_SHUFFLE(3, 2, 1, 0)); glm_vec4 const D = _mm_permute_ps(A, _MM_SHUFFLE(0, 1, 2, 3)); glm_vec4 const E = _mm_shuffle_ps(A, A, _MM_SHUFFLE(0, 1, 2, 3)); +# endif Error += sign::test(); Error += floor_::test();