diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index dda0b805..eea84732 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -713,7 +713,11 @@ #if GLM_HAS_CONSTEXPR # define GLM_CONSTEXPR constexpr -# define GLM_CONSTEXPR_CTOR constexpr +//# if GLM_ARCH == GLM_ARCH_PURE +# define GLM_CONSTEXPR_CTOR constexpr +//# else +//# define GLM_CONSTEXPR_CTOR +//# endif # define GLM_RELAXED_CONSTEXPR constexpr #elif GLM_HAS_CONSTEXPR_PARTIAL # define GLM_CONSTEXPR constexpr @@ -725,12 +729,6 @@ # define GLM_RELAXED_CONSTEXPR const #endif -#if GLM_ARCH == GLM_ARCH_PURE -# define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR -#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 5a03cd47..71c1efe2 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -86,24 +86,24 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR tvec4() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4 const& v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec4 const& v) GLM_DEFAULT; template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4 const& v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec4 const& v); // -- Explicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR_CTOR 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); + 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); // -- 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_SIMD tvec4(A a, B b, C c, D d); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(A a, B b, C c, D d); template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1 const& a, tvec1 const& b, tvec1 const& c, tvec1 const& d); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1 const& a, tvec1 const& b, tvec1 const& c, tvec1 const& d); // -- Conversion vector constructors -- diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 496da9d6..213b1bb4 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 tvec4::tvec4() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4() # ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0), z(0), w(0) # endif @@ -165,14 +165,14 @@ namespace detail # if !GLM_HAS_DEFAULTED_FUNCTIONS template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec4 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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 tvec4::tvec4(tvec4 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec4 const & v) : x(v.x), y(v.y), z(v.z), w(v.w) {} @@ -183,12 +183,12 @@ namespace detail {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(T scalar) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(T scalar) : x(scalar), y(scalar), z(scalar), w(scalar) {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(T a, T b, T c, T d) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(A a, B b, C c, D d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(A a, B b, C c, D d) : x(static_cast(a)), y(static_cast(b)), z(static_cast(c)), @@ -205,7 +205,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec1 const & a, tvec1 const & b, tvec1 const & c, tvec1 const & d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec1 const & a, tvec1 const & b, tvec1 const & c, tvec1 const & d) : x(static_cast(a.x)), y(static_cast(b.x)), z(static_cast(c.x)), diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index 55db422e..cdddd63b 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -363,117 +363,117 @@ namespace detail # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float s) : data(_mm_set1_ps(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float s) : data(_mm_set1_ps(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float s) : data(_mm_set1_ps(s)) {} # if GLM_ARCH & GLM_ARCH_AVX_BIT template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(double s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(double s) : data(_mm256_set1_pd(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(double s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(double s) : data(_mm256_set1_pd(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(double s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(double s) : data(_mm256_set1_pd(s)) {} # endif template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 s) : data(_mm_set1_epi32(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 s) : data(_mm_set1_epi32(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int32 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 s) : data(_mm_set1_epi32(s)) {} # if GLM_ARCH & GLM_ARCH_AVX2_BIT template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int64 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int64 s) : data(_mm256_set1_epi64x(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int64 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int64 s) : data(_mm256_set1_epi64x(s)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(int64 s) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int64 s) : data(_mm256_set1_epi64x(s)) {} # endif template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float a, float b, float c, float d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float a, float b, float c, float d) : data(_mm_set_ps(d, c, b, a)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float a, float b, float c, float d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(float a, float b, float c, float d) : data(_mm_set_ps(d, c, b, a)) {} template <> - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4::tvec4(float a, float b, float c, float d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_SIMD tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(int32 a, int32 b, int32 c, int32 d) : data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) {} }//namespace glm diff --git a/readme.md b/readme.md index 6326d385..01dddd46 100644 --- a/readme.md +++ b/readme.md @@ -53,7 +53,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) #### [GLM 0.9.8.2](https://github.com/g-truc/glm/tree/0.9.8) - 2016-09-25 ##### Fixes: - +- Fixed Visual C++ constexpr build error #555, #556 #### [GLM 0.9.8.1](https://github.com/g-truc/glm/releases/tag/0.9.8.1) - 2016-09-25 ##### Improvements: diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 71ab6e26..7c1627bf 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -1,4 +1,5 @@ glmCreateTestGTC(core_force_pure) +glmCreateTestGTC(core_force_unrestricted_gentype) glmCreateTestGTC(core_type_aligned) glmCreateTestGTC(core_type_cast) glmCreateTestGTC(core_type_ctor) diff --git a/test/core/core_force_unrestricted_gentype.cpp b/test/core/core_force_unrestricted_gentype.cpp new file mode 100644 index 00000000..46a8b1ed --- /dev/null +++ b/test/core/core_force_unrestricted_gentype.cpp @@ -0,0 +1,11 @@ +#define GLM_FORCE_UNRESTRICTED_GENTYPE + +#include + +int main() +{ + int Error = 0; + + return Error; +} +