From 5f5e800a24878ec7ece11366ff3c30de052da705 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 12 Oct 2016 10:45:43 +0200 Subject: [PATCH 1/2] Fixed clang and GCC build #559 --- glm/detail/setup.hpp | 12 +++++---- glm/detail/type_vec4.hpp | 14 +++++----- glm/detail/type_vec4.inl | 14 +++++----- glm/detail/type_vec4_simd.inl | 48 +++++++++++++++++------------------ 4 files changed, 45 insertions(+), 43 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index eea84732..e84648bd 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -713,11 +713,7 @@ #if GLM_HAS_CONSTEXPR # define GLM_CONSTEXPR constexpr -//# if GLM_ARCH == GLM_ARCH_PURE -# define GLM_CONSTEXPR_CTOR constexpr -//# else -//# define GLM_CONSTEXPR_CTOR -//# endif +# define GLM_CONSTEXPR_CTOR constexpr # define GLM_RELAXED_CONSTEXPR constexpr #elif GLM_HAS_CONSTEXPR_PARTIAL # define GLM_CONSTEXPR constexpr @@ -729,6 +725,12 @@ # define GLM_RELAXED_CONSTEXPR const #endif +#if GLM_ARCH == GLM_ARCH_PURE +# define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR_CTOR +#else +# define GLM_CONSTEXPR_SIMD +#endif + #ifdef GLM_FORCE_EXPLICIT_CTOR # define GLM_EXPLICIT explicit #else diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 71c1efe2..12eedd83 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -86,22 +86,22 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec4 const& v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(tvec4 const& v) GLM_DEFAULT; template - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec4 const& v); + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(tvec4 const& v); // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(ctor); - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(T scalar); - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(T a, T b, T c, T d); + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec4(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec4(T scalar); + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(T a, T b, T c, T d); // -- Conversion scalar constructors -- /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(A a, B b, C c, D d); + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(A a, B b, C c, D d); template GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1 const& a, tvec1 const& b, tvec1 const& c, tvec1 const& d); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 213b1bb4..6b4532ad 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -156,7 +156,7 @@ namespace detail # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4() # ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0), z(0), w(0) # endif @@ -165,30 +165,30 @@ namespace detail # if !GLM_HAS_DEFAULTED_FUNCTIONS template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec4 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(tvec4 const & v) : x(v.x), y(v.y), z(v.z), w(v.w) {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec4 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(tvec4 const & v) : x(v.x), y(v.y), z(v.z), w(v.w) {} // -- Explicit basic constructors -- template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(ctor) {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(T scalar) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(T scalar) : x(scalar), y(scalar), z(scalar), w(scalar) {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(T a, T b, T c, T d) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(T a, T b, T c, T d) : x(a), y(b), z(c), w(d) {} @@ -196,7 +196,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(A a, B b, C c, D d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(A a, B b, C c, D d) : x(static_cast(a)), y(static_cast(b)), z(static_cast(c)), diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index cdddd63b..90652fd9 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -341,21 +341,21 @@ namespace detail # if !GLM_HAS_DEFAULTED_FUNCTIONS template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4() # ifndef GLM_FORCE_NO_CTOR_INIT : data(_mm_setzero_ps()) # endif {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4() # ifndef GLM_FORCE_NO_CTOR_INIT : data(_mm_setzero_ps()) # endif {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4() # ifndef GLM_FORCE_NO_CTOR_INIT : data(_mm_setzero_ps()) # endif @@ -363,117 +363,117 @@ namespace detail # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float s) : data(_mm_set1_ps(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float s) : data(_mm_set1_ps(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float s) : data(_mm_set1_ps(s)) {} # if GLM_ARCH & GLM_ARCH_AVX_BIT template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(double s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(double s) : data(_mm256_set1_pd(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(double s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(double s) : data(_mm256_set1_pd(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(double s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(double s) : data(_mm256_set1_pd(s)) {} # endif template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 s) : data(_mm_set1_epi32(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 s) : data(_mm_set1_epi32(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 s) : data(_mm_set1_epi32(s)) {} # if GLM_ARCH & GLM_ARCH_AVX2_BIT template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int64 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int64 s) : data(_mm256_set1_epi64x(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int64 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int64 s) : data(_mm256_set1_epi64x(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int64 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int64 s) : data(_mm256_set1_epi64x(s)) {} # endif template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float a, float b, float c, float d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float a, float b, float c, float d) : data(_mm_set_ps(d, c, b, a)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float a, float b, float c, float d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float a, float b, float c, float d) : data(_mm_set_ps(d, c, b, a)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float a, float b, float c, float d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float a, float b, float c, float d) : data(_mm_set_ps(d, c, b, a)) {} template <> template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_set_epi32(d, c, b, a)) {} template <> template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_set_epi32(d, c, b, a)) {} template <> template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_set_epi32(d, c, b, a)) {} template <> template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) {} template <> template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) {} template <> template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) {} }//namespace glm From 1c85265f97d82b11dc78d651156cd1815e01441c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 12 Oct 2016 21:40:03 +0200 Subject: [PATCH 2/2] Added Visual C++ 15 detection, Added Clang 4.0 detection, Refactored GLM_COMPILER_VC values --- glm/detail/func_matrix.hpp | 2 +- glm/detail/setup.hpp | 51 +++++++++-------- glm/simd/platform.h | 50 ++++++++++------- readme.md | 5 ++ test/core/core_force_pure.cpp | 4 +- test/core/core_setup_message.cpp | 94 ++++++++++++++++++-------------- test/gtc/gtc_bitfield.cpp | 8 +-- 7 files changed, 124 insertions(+), 90 deletions(-) diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index 77fdb3fe..9be34495 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -120,7 +120,7 @@ namespace detail /// /// @see GLSL transpose man page /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions -# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) +# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) template class matType> GLM_FUNC_DECL typename matType::transpose_type transpose(matType const & x); # endif diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index e84648bd..e4308d17 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -184,11 +184,11 @@ # ifdef _MSC_EXTENSIONS # if __cplusplus >= 201402L # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) -//# elif GLM_COMPILER >= GLM_COMPILER_VC2015 +//# elif GLM_COMPILER >= GLM_COMPILER_VC14 //# define GLM_LANG (GLM_LANG_CXX1Y | GLM_LANG_CXXMS_FLAG) # elif __cplusplus >= 201103L # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) -# elif GLM_COMPILER >= GLM_COMPILER_VC2010 +# elif GLM_COMPILER >= GLM_COMPILER_VC10 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) # elif __cplusplus >= 199711L # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) @@ -200,7 +200,7 @@ # define GLM_LANG GLM_LANG_CXX14 # elif __cplusplus >= 201103L # define GLM_LANG GLM_LANG_CXX11 -# elif GLM_COMPILER >= GLM_COMPILER_VC2010 +# elif GLM_COMPILER >= GLM_COMPILER_VC10 # define GLM_LANG GLM_LANG_CXX0X # elif __cplusplus >= 199711L # define GLM_LANG GLM_LANG_CXX98 @@ -294,7 +294,7 @@ #else # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)))) #endif @@ -305,9 +305,9 @@ # define GLM_HAS_STATIC_ASSERT 1 #else # define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ + ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)))) + ((GLM_COMPILER & GLM_COMPILER_VC)))) #endif // N1988 @@ -315,10 +315,10 @@ # define GLM_HAS_EXTENDED_INTEGER_TYPE 1 #else # define GLM_HAS_EXTENDED_INTEGER_TYPE (\ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG30))) + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC)) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG))) #endif // N2235 @@ -330,8 +330,9 @@ # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR #else # define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)))) // GCC 4.6 support constexpr but there is a compiler bug causing a crash -# define GLM_HAS_CONSTEXPR_PARTIAL (GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015))) +# define GLM_HAS_CONSTEXPR_PARTIAL (GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14))) #endif // N2672 @@ -341,8 +342,8 @@ # define GLM_HAS_INITIALIZER_LISTS 1 #else # define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ + ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)))) #endif @@ -367,8 +368,8 @@ # define GLM_HAS_DEFAULTED_FUNCTIONS 1 #else # define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ + ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)) || \ (GLM_COMPILER & GLM_COMPILER_CUDA))) #endif @@ -380,8 +381,8 @@ # define GLM_HAS_RVALUE_REFERENCES 1 #else # define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ + ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) #endif @@ -394,7 +395,7 @@ # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) #endif @@ -407,7 +408,7 @@ # define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) #endif @@ -420,7 +421,7 @@ # define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) #endif @@ -433,7 +434,7 @@ # define GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70)))) #endif @@ -442,6 +443,7 @@ # define GLM_HAS_ASSIGNABLE 1 #else # define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \ ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))) #endif @@ -453,7 +455,7 @@ # define GLM_HAS_MAKE_SIGNED 1 #else # define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) #endif @@ -461,7 +463,8 @@ # define GLM_HAS_BITSCAN_WINDOWS 0 #else # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ - (GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)))) + ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT)))) #endif // OpenMP @@ -487,7 +490,7 @@ # define GLM_HAS_OPENMP 0 # endif # elif GLM_COMPILER & GLM_COMPILER_VC -# if GLM_COMPILER >= GLM_COMPILER_VC2010 +# if GLM_COMPILER >= GLM_COMPILER_VC10 # define GLM_HAS_OPENMP 20 # else # define GLM_HAS_OPENMP 0 @@ -660,7 +663,7 @@ # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name # define GLM_RESTRICT_FUNC __declspec(restrict) # define GLM_RESTRICT __restrict -# if GLM_COMPILER >= GLM_COMPILER_VC2013 +# if GLM_COMPILER >= GLM_COMPILER_VC12 # define GLM_VECTOR_CALL __vectorcall # else # define GLM_VECTOR_CALL diff --git a/glm/simd/platform.h b/glm/simd/platform.h index 85eb4b5a..d74f23f0 100644 --- a/glm/simd/platform.h +++ b/glm/simd/platform.h @@ -86,10 +86,11 @@ // Visual C++ defines #define GLM_COMPILER_VC 0x01000000 -#define GLM_COMPILER_VC2010 0x01000090 -#define GLM_COMPILER_VC2012 0x010000A0 -#define GLM_COMPILER_VC2013 0x010000B0 -#define GLM_COMPILER_VC2015 0x010000C0 +#define GLM_COMPILER_VC10 0x01000090 +#define GLM_COMPILER_VC11 0x010000A0 +#define GLM_COMPILER_VC12 0x010000B0 +#define GLM_COMPILER_VC14 0x010000C0 +#define GLM_COMPILER_VC15 0x010000D0 // GCC defines #define GLM_COMPILER_GCC 0x02000000 @@ -126,14 +127,17 @@ // Clang #define GLM_COMPILER_CLANG 0x20000000 -#define GLM_COMPILER_CLANG32 0x20000030 -#define GLM_COMPILER_CLANG33 0x20000040 -#define GLM_COMPILER_CLANG34 0x20000050 -#define GLM_COMPILER_CLANG35 0x20000060 -#define GLM_COMPILER_CLANG36 0x20000070 -#define GLM_COMPILER_CLANG37 0x20000080 -#define GLM_COMPILER_CLANG38 0x20000090 -#define GLM_COMPILER_CLANG39 0x200000A0 +#define GLM_COMPILER_CLANG32 0x20000030 +#define GLM_COMPILER_CLANG33 0x20000040 +#define GLM_COMPILER_CLANG34 0x20000050 +#define GLM_COMPILER_CLANG35 0x20000060 +#define GLM_COMPILER_CLANG36 0x20000070 +#define GLM_COMPILER_CLANG37 0x20000080 +#define GLM_COMPILER_CLANG38 0x20000090 +#define GLM_COMPILER_CLANG39 0x200000A0 +#define GLM_COMPILER_CLANG40 0x200000B0 +#define GLM_COMPILER_CLANG41 0x200000C0 +#define GLM_COMPILER_CLANG42 0x200000D0 // Build model #define GLM_MODEL_32 0x00000010 @@ -208,8 +212,14 @@ # define GLM_COMPILER GLM_COMPILER_CLANG38 # elif __clang_major__ == 3 && __clang_minor__ >= 9 # define GLM_COMPILER GLM_COMPILER_CLANG39 +# elif __clang_major__ == 4 && __clang_minor__ == 0 +# define GLM_COMPILER GLM_COMPILER_CLANG40 +# elif __clang_major__ == 4 && __clang_minor__ == 1 +# define GLM_COMPILER GLM_COMPILER_CLANG41 +# elif __clang_major__ == 4 && __clang_minor__ >= 2 +# define GLM_COMPILER GLM_COMPILER_CLANG42 # elif __clang_major__ >= 4 -# define GLM_COMPILER GLM_COMPILER_CLANG39 +# define GLM_COMPILER GLM_COMPILER_CLANG42 # else # define GLM_COMPILER GLM_COMPILER_CLANG # endif @@ -218,15 +228,17 @@ // Visual C++ #elif defined(_MSC_VER) # if _MSC_VER < 1600 -# error "GLM requires Visual C++ 2010 or higher" +# error "GLM requires Visual C++ 10 - 2010 or higher" # elif _MSC_VER == 1600 -# define GLM_COMPILER GLM_COMPILER_VC2010 +# define GLM_COMPILER GLM_COMPILER_VC11 # elif _MSC_VER == 1700 -# define GLM_COMPILER GLM_COMPILER_VC2012 +# define GLM_COMPILER GLM_COMPILER_VC11 # elif _MSC_VER == 1800 -# define GLM_COMPILER GLM_COMPILER_VC2013 -# elif _MSC_VER >= 1900 -# define GLM_COMPILER GLM_COMPILER_VC2015 +# define GLM_COMPILER GLM_COMPILER_VC12 +# elif _MSC_VER == 1900 +# define GLM_COMPILER GLM_COMPILER_VC14 +# elif _MSC_VER >= 1910 +# define GLM_COMPILER GLM_COMPILER_VC15 # else//_MSC_VER # define GLM_COMPILER GLM_COMPILER_VC # endif//_MSC_VER diff --git a/readme.md b/readme.md index 01dddd46..45a23da6 100644 --- a/readme.md +++ b/readme.md @@ -52,6 +52,11 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ## Release notes #### [GLM 0.9.8.2](https://github.com/g-truc/glm/tree/0.9.8) - 2016-09-25 +##### Improvements: +- Added Visual C++ 15 detection +- Added Clang 4.0 detection +- Refactored GLM_COMPILER_VC values + ##### Fixes: - Fixed Visual C++ constexpr build error #555, #556 diff --git a/test/core/core_force_pure.cpp b/test/core/core_force_pure.cpp index 68f82119..7df770e4 100644 --- a/test/core/core_force_pure.cpp +++ b/test/core/core_force_pure.cpp @@ -1,4 +1,6 @@ -#define GLM_FORCE_PURE +#ifndef GLM_FORCE_PURE +# define GLM_FORCE_PURE +#endif//GLM_FORCE_PURE #define GLM_FORCE_ALIGNED #define GLM_FORCE_SWIZZLE #include diff --git a/test/core/core_setup_message.cpp b/test/core/core_setup_message.cpp index 7eaf7028..ff5caf41 100644 --- a/test/core/core_setup_message.cpp +++ b/test/core/core_setup_message.cpp @@ -10,17 +10,20 @@ int test_compiler() { switch(GLM_COMPILER) { - case GLM_COMPILER_VC2010: - std::printf("GLM_COMPILER_VC2010\n"); + case GLM_COMPILER_VC10: + std::printf("Visual C++ 10 - 2010\n"); break; - case GLM_COMPILER_VC2012: - std::printf("GLM_COMPILER_VC2012\n"); + case GLM_COMPILER_VC11: + std::printf("Visual C++ 11 - 2012\n"); break; - case GLM_COMPILER_VC2013: - std::printf("GLM_COMPILER_VC2013\n"); + case GLM_COMPILER_VC12: + std::printf("Visual C++ 12 - 2013\n"); break; - case GLM_COMPILER_VC2015: - std::printf("GLM_COMPILER_VC2015\n"); + case GLM_COMPILER_VC14: + std::printf("Visual C++ 14 - 2015\n"); + break; + case GLM_COMPILER_VC15: + std::printf("Visual C++ 15 - 201X\n"); break; default: std::printf("Visual C++ version not detected\n"); @@ -33,58 +36,58 @@ int test_compiler() switch(GLM_COMPILER) { case GLM_COMPILER_GCC44: - std::printf("GLM_COMPILER_GCC44\n"); + std::printf("GCC 4.4\n"); break; case GLM_COMPILER_GCC45: - std::printf("GLM_COMPILER_GCC45\n"); + std::printf("GCC 4.5\n"); break; case GLM_COMPILER_GCC46: - std::printf("GLM_COMPILER_GCC46\n"); + std::printf("GCC 4.6\n"); break; case GLM_COMPILER_GCC47: - std::printf("GLM_COMPILER_GCC47\n"); + std::printf("GCC 4.7\n"); break; case GLM_COMPILER_GCC48: - std::printf("GLM_COMPILER_GCC48\n"); + std::printf("GCC 4.8\n"); break; case GLM_COMPILER_GCC49: - std::printf("GLM_COMPILER_GCC49\n"); + std::printf("GCC 4.9\n"); break; case GLM_COMPILER_GCC50: - std::printf("GLM_COMPILER_GCC50\n"); + std::printf("GCC 5.0\n"); break; case GLM_COMPILER_GCC51: - std::printf("GLM_COMPILER_GCC51\n"); + std::printf("GCC 5.1\n"); break; case GLM_COMPILER_GCC52: - std::printf("GLM_COMPILER_GCC52\n"); + std::printf("GCC 5.2\n"); break; case GLM_COMPILER_GCC53: - std::printf("GLM_COMPILER_GCC53\n"); + std::printf("GCC 5.3\n"); break; case GLM_COMPILER_GCC54: - std::printf("GLM_COMPILER_GCC54\n"); + std::printf("GCC 5.4\n"); break; case GLM_COMPILER_GCC60: - std::printf("GLM_COMPILER_GCC60\n"); + std::printf("GCC 6.0\n"); break; case GLM_COMPILER_GCC61: - std::printf("GLM_COMPILER_GCC61\n"); + std::printf("GCC 6.1\n"); break; case GLM_COMPILER_GCC62: - std::printf("GLM_COMPILER_GCC62\n"); + std::printf("GCC 6.2\n"); break; case GLM_COMPILER_GCC70: - std::printf("GLM_COMPILER_GCC70\n"); + std::printf("GCC 7.0\n"); break; case GLM_COMPILER_GCC71: - std::printf("GLM_COMPILER_GCC71\n"); + std::printf("GCC 7.1\n"); break; case GLM_COMPILER_GCC72: - std::printf("GLM_COMPILER_GCC72\n"); + std::printf("GCC 7.2\n"); break; case GLM_COMPILER_GCC80: - std::printf("GLM_COMPILER_GCC80\n"); + std::printf("GCC 8.0\n"); break; default: std::printf("GCC version not detected\n"); @@ -94,35 +97,44 @@ int test_compiler() } else if(GLM_COMPILER & GLM_COMPILER_CUDA) { - std::printf("GLM_COMPILER_CUDA\n"); + std::printf("CUDA\n"); } else if(GLM_COMPILER & GLM_COMPILER_CLANG) { switch(GLM_COMPILER) { case GLM_COMPILER_CLANG32: - std::printf("GLM_COMPILER_CLANG32\n"); + std::printf("Clang 3.2\n"); break; case GLM_COMPILER_CLANG33: - std::printf("GLM_COMPILER_CLANG33\n"); + std::printf("Clang 3.3\n"); break; case GLM_COMPILER_CLANG34: - std::printf("GLM_COMPILER_CLANG34\n"); + std::printf("Clang 3.4\n"); break; case GLM_COMPILER_CLANG35: - std::printf("GLM_COMPILER_CLANG35\n"); + std::printf("Clang 3.5\n"); break; case GLM_COMPILER_CLANG36: - std::printf("GLM_COMPILER_CLANG36\n"); + std::printf("Clang 3.6\n"); break; case GLM_COMPILER_CLANG37: - std::printf("GLM_COMPILER_CLANG37\n"); + std::printf("Clang 3.7\n"); break; case GLM_COMPILER_CLANG38: - std::printf("GLM_COMPILER_CLANG38\n"); + std::printf("Clang 3.8\n"); break; case GLM_COMPILER_CLANG39: - std::printf("GLM_COMPILER_CLANG39\n"); + std::printf("Clang 3.9\n"); + break; + case GLM_COMPILER_CLANG40: + std::printf("Clang 4.0\n"); + break; + case GLM_COMPILER_CLANG41: + std::printf("Clang 4.1\n"); + break; + case GLM_COMPILER_CLANG42: + std::printf("Clang 4.2\n"); break; default: std::printf("LLVM version not detected\n"); @@ -134,22 +146,22 @@ int test_compiler() switch(GLM_COMPILER) { case GLM_COMPILER_INTEL12: - std::printf("GLM_COMPILER_INTEL12\n"); + std::printf("ICC 12\n"); break; case GLM_COMPILER_INTEL12_1: - std::printf("GLM_COMPILER_INTEL12_1\n"); + std::printf("ICC 12.1\n"); break; case GLM_COMPILER_INTEL13: - std::printf("GLM_COMPILER_INTEL13\n"); + std::printf("ICC 13\n"); break; case GLM_COMPILER_INTEL14: - std::printf("GLM_COMPILER_INTEL14\n"); + std::printf("ICC 14\n"); break; case GLM_COMPILER_INTEL15: - std::printf("GLM_COMPILER_INTEL15\n"); + std::printf("ICC 15\n"); break; case GLM_COMPILER_INTEL16: - std::printf("GLM_COMPILER_INTEL16\n"); + std::printf("ICC 16\n"); break; default: std::printf("Intel compiler version not detected\n"); diff --git a/test/gtc/gtc_bitfield.cpp b/test/gtc/gtc_bitfield.cpp index bf43ca9d..a22ff860 100644 --- a/test/gtc/gtc_bitfield.cpp +++ b/test/gtc/gtc_bitfield.cpp @@ -341,7 +341,7 @@ namespace bitfieldInterleave return REG1 | (REG2 << 1); } */ -#if(GLM_ARCH != GLM_ARCH_PURE) +#if GLM_ARCH & GLM_ARCH_SSE2_BIT inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y) { GLM_ALIGN(16) glm::uint32 const Array[4] = {x, 0, y, 0}; @@ -457,7 +457,7 @@ namespace bitfieldInterleave return Result[0]; } -#endif//(GLM_ARCH != GLM_ARCH_PURE) +#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT int test() { @@ -563,7 +563,7 @@ namespace bitfieldInterleave std::printf("interleaveBitfieldInterleave Time %d clocks\n", static_cast(Time)); } -# if(GLM_ARCH != GLM_ARCH_PURE) +# if GLM_ARCH & GLM_ARCH_SSE2_BIT { std::clock_t LastTime = std::clock(); @@ -585,7 +585,7 @@ namespace bitfieldInterleave std::printf("sseUnalignedBitfieldInterleave Time %d clocks\n", static_cast(Time)); } -# endif//(GLM_ARCH != GLM_ARCH_PURE) +# endif//GLM_ARCH & GLM_ARCH_SSE2_BIT { std::clock_t LastTime = std::clock();