Fixed constexpr with SIMD interaction

This commit is contained in:
Christophe Riccio 2016-05-05 20:43:09 +02:00
parent 92a46735d6
commit a6047251be
4 changed files with 15 additions and 9 deletions

View file

@ -737,11 +737,17 @@
# define GLM_RELAXED_CONSTEXPR const
#endif
#if GLM_ARCH == GLM_ARCH_PURE
# define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR
#else
# define GLM_CONSTEXPR_SIMD
#endif
// GCC 4.6 has a bug causing a compiler crash
#if GLM_COMPILER & GLM_COMPILER_GCC
# define GLM_CONSTEXPR_GCC
# define GLM_CONSTEXPR_GCC
#else
# define GLM_CONSTEXPR_GCC GLM_CONSTEXPR
# define GLM_CONSTEXPR_GCC GLM_CONSTEXPR
#endif
#ifdef GLM_FORCE_EXPLICIT_CTOR

View file

@ -158,8 +158,8 @@ namespace detail
// -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR_GCC explicit tvec4(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d);
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 --

View file

@ -63,12 +63,12 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec4<T, P>::tvec4(T scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(T scalar)
: x(scalar), y(scalar), z(scalar), w(scalar)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<T, P>::tvec4(T a, T b, T c, T d)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(T a, T b, T c, T d)
: x(a), y(b), z(c), w(d)
{}

View file

@ -36,7 +36,7 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<float, simd>::tvec4()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, simd>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps())
# endif
@ -44,12 +44,12 @@ namespace glm
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec4<float, simd>::tvec4(float s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, simd>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<float, simd>::tvec4(float a, float b, float c, float d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, simd>::tvec4(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a))
{}