diff --git a/glm/detail/func_common_simd.inl b/glm/detail/func_common_simd.inl index a3482ff4..ce0032d3 100644 --- a/glm/detail/func_common_simd.inl +++ b/glm/detail/func_common_simd.inl @@ -99,22 +99,22 @@ namespace detail }; template - struct compute_min_vector<4, int32, Q, true> + struct compute_min_vector<4, int, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v1, vec<4, int, Q> const& v2) { - vec<4, int32, Q> result; + vec<4, int, Q> result; result.data = _mm_min_epi32(v1.data, v2.data); return result; } }; template - struct compute_min_vector<4, uint32, Q, true> + struct compute_min_vector<4, uint, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& v1, vec<4, uint, Q> const& v2) { - vec<4, uint32, Q> result; + vec<4, uint, Q> result; result.data = _mm_min_epu32(v1.data, v2.data); return result; } @@ -132,22 +132,22 @@ namespace detail }; template - struct compute_max_vector<4, int32, Q, true> + struct compute_max_vector<4, int, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v1, vec<4, int, Q> const& v2) { - vec<4, int32, Q> result; + vec<4, int, Q> result; result.data = _mm_max_epi32(v1.data, v2.data); return result; } }; template - struct compute_max_vector<4, uint32, Q, true> + struct compute_max_vector<4, uint, Q, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2) + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& v1, vec<4, uint, Q> const& v2) { - vec<4, uint32, Q> result; + vec<4, uint, Q> result; result.data = _mm_max_epu32(v1.data, v2.data); return result; } @@ -165,22 +165,22 @@ namespace detail }; template - struct compute_clamp_vector<4, int32, Q, true> + struct compute_clamp_vector<4, int, Q, true> { - 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) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& x, vec<4, int, Q> const& minVal, vec<4, int, Q> const& maxVal) { - vec<4, int32, Q> result; + vec<4, int, 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, Q, true> + struct compute_clamp_vector<4, uint, Q, true> { - 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) + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& x, vec<4, uint, Q> const& minVal, vec<4, uint, Q> const& maxVal) { - vec<4, uint32, Q> result; + vec<4, uint, Q> result; result.data = _mm_min_epu32(_mm_max_epu32(x.data, minVal.data), maxVal.data); return result; } diff --git a/glm/detail/func_integer_simd.inl b/glm/detail/func_integer_simd.inl index 690671a3..8be6c9ce 100644 --- a/glm/detail/func_integer_simd.inl +++ b/glm/detail/func_integer_simd.inl @@ -1,6 +1,3 @@ -/// @ref core -/// @file glm/detail/func_integer_simd.inl - #include "../simd/integer.h" #if GLM_ARCH & GLM_ARCH_SSE2_BIT @@ -9,9 +6,9 @@ namespace glm{ namespace detail { template - struct compute_bitfieldReverseStep<4, uint32, Q, true, true> + struct compute_bitfieldReverseStep<4, uint, Q, true, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& v, uint Mask, uint Shift) { __m128i const set0 = v.data; @@ -30,9 +27,9 @@ namespace detail }; template - struct compute_bitfieldBitCountStep<4, uint32, Q, true, true> + struct compute_bitfieldBitCountStep<4, uint, Q, true, true> { - GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& v, uint Mask, uint Shift) { __m128i const set0 = v.data; @@ -49,14 +46,14 @@ namespace detail # if GLM_ARCH & GLM_ARCH_AVX_BIT template<> - GLM_FUNC_QUALIFIER int bitCount(uint32 x) + GLM_FUNC_QUALIFIER int bitCount(uint x) { return _mm_popcnt_u32(x); } # if(GLM_MODEL == GLM_MODEL_64) template<> - GLM_FUNC_QUALIFIER int bitCount(uint64 x) + GLM_FUNC_QUALIFIER int bitCount(detail::uint64 x) { return static_cast(_mm_popcnt_u64(x)); } diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 8692f175..fc365106 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -72,7 +72,10 @@ #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG -#ifdef _MSC_EXTENSIONS +//#ifdef _MSC_EXTENSIONS +#if ((GLM_COMPILER & GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS)) +# define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG +#elif (!(GLM_COMPILER & GLM_COMPILER_VC) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)) # define GLM_LANG_EXT GLM_LANG_CXXMS_FLAG #else # define GLM_LANG_EXT 0 diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index 02cf0cfa..6d1a206a 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -24,26 +24,26 @@ namespace detail }; template - struct _swizzle_base1<4, int32, Q, E0,E1,E2,E3, true> : public _swizzle_base0 + struct _swizzle_base1<4, int, Q, E0,E1,E2,E3, true> : public _swizzle_base0 { - GLM_FUNC_QUALIFIER vec<4, int32, Q> operator ()() const + GLM_FUNC_QUALIFIER vec<4, int, Q> operator ()() const { __m128i data = *reinterpret_cast<__m128i const*>(&this->_buffer); - vec<4, int32, Q> Result; + vec<4, int, Q> Result; Result.data = _mm_shuffle_epi32(data, _MM_SHUFFLE(E3, E2, E1, E0)); return Result; } }; template - struct _swizzle_base1<4, uint32, Q, E0,E1,E2,E3, true> : public _swizzle_base0 + struct _swizzle_base1<4, uint, Q, E0,E1,E2,E3, true> : public _swizzle_base0 { - GLM_FUNC_QUALIFIER vec<4, uint32, Q> operator ()() const + GLM_FUNC_QUALIFIER vec<4, uint, Q> operator ()() const { __m128i data = *reinterpret_cast<__m128i const*>(&this->_buffer); - vec<4, uint32, Q> Result; + vec<4, uint, Q> Result; Result.data = _mm_shuffle_epi32(data, _MM_SHUFFLE(E3, E2, E1, E0)); return Result; } @@ -313,9 +313,9 @@ namespace detail }; template - struct compute_vec4_equal + struct compute_vec4_equal { - static bool call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) + static bool call(vec<4, int, Q> const& v1, vec<4, int, Q> const& v2) { //return _mm_movemask_epi8(_mm_cmpeq_epi32(v1.data, v2.data)) != 0; __m128i neq = _mm_xor_si128(v1.data, v2.data); @@ -333,9 +333,9 @@ namespace detail }; template - struct compute_vec4_nequal + struct compute_vec4_nequal { - static bool call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2) + static bool call(vec<4, int, Q> const& v1, vec<4, int, Q> const& v2) { //return _mm_movemask_epi8(_mm_cmpneq_epi32(v1.data, v2.data)) != 0; __m128i neq = _mm_xor_si128(v1.data, v2.data); @@ -378,33 +378,33 @@ namespace detail # endif template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int32, aligned_lowp>::vec(int32 _s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int, aligned_lowp>::vec(int _s) : data(_mm_set1_epi32(_s)) {} template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int32, aligned_mediump>::vec(int32 _s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int, aligned_mediump>::vec(int _s) : data(_mm_set1_epi32(_s)) {} template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int32, aligned_highp>::vec(int32 _s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int, aligned_highp>::vec(int _s) : data(_mm_set1_epi32(_s)) {} # if GLM_ARCH & GLM_ARCH_AVX2_BIT template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int64, aligned_lowp>::vec(int64 _s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, detail::int64, aligned_lowp>::vec(detail::int64 _s) : data(_mm256_set1_epi64x(_s)) {} template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int64, aligned_mediump>::vec(int64 _s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, detail::int64, aligned_mediump>::vec(detail::int64 _s) : data(_mm256_set1_epi64x(_s)) {} template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int64, aligned_highp>::vec(int64 _s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int64, aligned_highp>::vec(detail::int64 _s) : data(_mm256_set1_epi64x(_s)) {} # endif @@ -426,37 +426,37 @@ namespace detail template<> template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int32, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int, aligned_lowp>::vec(int _x, int _y, int _z, int _w) : data(_mm_set_epi32(_w, _z, _y, _x)) {} template<> template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int32, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int, aligned_mediump>::vec(int _x, int _y, int _z, int _w) : data(_mm_set_epi32(_w, _z, _y, _x)) {} template<> template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int32, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, int, aligned_highp>::vec(int _x, int _y, int _z, int _w) : data(_mm_set_epi32(_w, _z, _y, _x)) {} template<> template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_lowp>::vec(int _x, int _y, int _z, int _w) : data(_mm_cvtepi32_ps(_mm_set_epi32(_w, _z, _y, _x))) {} template<> template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_mediump>::vec(int _x, int _y, int _z, int _w) : data(_mm_cvtepi32_ps(_mm_set_epi32(_w, _z, _y, _x))) {} template<> template<> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_highp>::vec(int _x, int _y, int _z, int _w) : data(_mm_cvtepi32_ps(_mm_set_epi32(_w, _z, _y, _x))) {} #endif// GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE diff --git a/glm/ext/quaternion_common_simd.inl b/glm/ext/quaternion_common_simd.inl new file mode 100644 index 00000000..ddfc8a44 --- /dev/null +++ b/glm/ext/quaternion_common_simd.inl @@ -0,0 +1,18 @@ +#if GLM_ARCH & GLM_ARCH_SSE2_BIT + +namespace glm{ +namespace detail +{ + template + struct compute_dot, float, true> + { + static GLM_FUNC_QUALIFIER float call(qua const& x, qua const& y) + { + return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); + } + }; +}//namespace detail +}//namespace glm + +#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT + diff --git a/glm/ext/quaternion_exponential.inl b/glm/ext/quaternion_exponential.inl index 20245be1..1365d0a9 100644 --- a/glm/ext/quaternion_exponential.inl +++ b/glm/ext/quaternion_exponential.inl @@ -66,7 +66,4 @@ namespace glm } }//namespace glm -#if GLM_CONFIG_SIMD == GLM_ENABLE -# include "quaternion_exponential_simd.inl" -#endif diff --git a/glm/ext/quaternion_transform.inl b/glm/ext/quaternion_transform.inl index b9edeb19..964495b6 100644 --- a/glm/ext/quaternion_transform.inl +++ b/glm/ext/quaternion_transform.inl @@ -56,7 +56,3 @@ namespace glm } }//namespace glm -#if GLM_CONFIG_SIMD == GLM_ENABLE -# include "quaternion_transform_simd.inl" -#endif - diff --git a/glm/ext/quaternion_trigonometric.inl b/glm/ext/quaternion_trigonometric.inl index ef58aac2..0c0bf63f 100644 --- a/glm/ext/quaternion_trigonometric.inl +++ b/glm/ext/quaternion_trigonometric.inl @@ -25,8 +25,3 @@ namespace glm return qua(glm::cos(a * static_cast(0.5)), v * s); } }//namespace glm - -#if GLM_CONFIG_SIMD == GLM_ENABLE -# include "quaternion_trigonometric_simd.inl" -#endif - diff --git a/glm/gtc/quaternion_simd.inl b/glm/gtc/quaternion_simd.inl index ddfc8a44..e69de29b 100644 --- a/glm/gtc/quaternion_simd.inl +++ b/glm/gtc/quaternion_simd.inl @@ -1,18 +0,0 @@ -#if GLM_ARCH & GLM_ARCH_SSE2_BIT - -namespace glm{ -namespace detail -{ - template - struct compute_dot, float, true> - { - static GLM_FUNC_QUALIFIER float call(qua const& x, qua const& y) - { - return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); - } - }; -}//namespace detail -}//namespace glm - -#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT - diff --git a/glm/simd/platform.h b/glm/simd/platform.h index eab6c1f4..6317663a 100644 --- a/glm/simd/platform.h +++ b/glm/simd/platform.h @@ -1,6 +1,3 @@ -/// @ref simd -/// @file glm/simd/platform.h - #pragma once /////////////////////////////////////////////////////////////////////////////////// diff --git a/test/core/core_force_pure.cpp b/test/core/core_force_pure.cpp index bd6a11df..4ac61761 100644 --- a/test/core/core_force_pure.cpp +++ b/test/core/core_force_pure.cpp @@ -341,32 +341,32 @@ int test_vec4_swizzle_partial() { int Error = 0; - glm::vec4 A(1, 2, 3, 4); + glm::ivec4 A(1, 2, 3, 4); # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR { - glm::vec4 B(A.xy, A.zw); + glm::ivec4 B(A.xy, A.zw); Error += A == B ? 0 : 1; } { - glm::vec4 B(A.xy, 3.0f, 4.0f); + glm::ivec4 B(A.xy, 3.0f, 4.0f); Error += A == B ? 0 : 1; } { - glm::vec4 B(1.0f, A.yz, 4.0f); + glm::ivec4 B(1.0f, A.yz, 4.0f); Error += A == B ? 0 : 1; } { - glm::vec4 B(1.0f, 2.0f, A.zw); + glm::ivec4 B(1.0f, 2.0f, A.zw); Error += A == B ? 0 : 1; } { - glm::vec4 B(A.xyz, 4.0f); + glm::ivec4 B(A.xyz, 4.0f); Error += A == B ? 0 : 1; } { - glm::vec4 B(1.0f, A.yzw); + glm::ivec4 B(1.0f, A.yzw); Error += A == B ? 0 : 1; } # endif