Fixed clang and GCC build #559

This commit is contained in:
Christophe Riccio 2016-10-12 10:45:43 +02:00
parent 19a6d64e8c
commit 5f5e800a24
4 changed files with 45 additions and 43 deletions

View File

@ -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_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

View File

@ -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<T, P> const& v) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(tvec4<T, P> const& v) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec4<T, Q> const& v);
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(tvec4<T, Q> 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 <typename A, typename B, typename C, typename D>
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 <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1<A, P> const& a, tvec1<B, P> const& b, tvec1<C, P> const& c, tvec1<D, P> const& d);

View File

@ -156,7 +156,7 @@ namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<T, P>::tvec4()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<T, P>::tvec4(tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(tvec4<T, P> const & v)
: x(v.x), y(v.y), z(v.z), w(v.w)
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<T, P>::tvec4(tvec4<T, Q> const & v)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(tvec4<T, Q> const & v)
: x(v.x), y(v.y), z(v.z), w(v.w)
{}
// -- Explicit basic constructors --
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<T, P>::tvec4(ctor)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(ctor)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR 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_CTOR 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)
{}
@ -196,7 +196,7 @@ namespace detail
template <typename T, precision P>
template <typename A, typename B, typename C, typename D>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<T, P>::tvec4(A a, B b, C c, D d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(A a, B b, C c, D d) :
x(static_cast<T>(a)),
y(static_cast<T>(b)),
z(static_cast<T>(c)),

View File

@ -341,21 +341,21 @@ namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, aligned_lowp>::tvec4()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps())
# endif
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, aligned_mediump>::tvec4()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps())
# endif
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, aligned_highp>::tvec4()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::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<float, aligned_lowp>::tvec4(float s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, aligned_mediump>::tvec4(float s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, aligned_highp>::tvec4(float s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
# if GLM_ARCH & GLM_ARCH_AVX_BIT
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<double, aligned_lowp>::tvec4(double s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_lowp>::tvec4(double s) :
data(_mm256_set1_pd(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<double, aligned_mediump>::tvec4(double s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_mediump>::tvec4(double s) :
data(_mm256_set1_pd(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<double, aligned_highp>::tvec4(double s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_highp>::tvec4(double s) :
data(_mm256_set1_pd(s))
{}
# endif
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<int32, aligned_lowp>::tvec4(int32 s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_lowp>::tvec4(int32 s) :
data(_mm_set1_epi32(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<int32, aligned_mediump>::tvec4(int32 s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_mediump>::tvec4(int32 s) :
data(_mm_set1_epi32(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<int32, aligned_highp>::tvec4(int32 s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_highp>::tvec4(int32 s) :
data(_mm_set1_epi32(s))
{}
# if GLM_ARCH & GLM_ARCH_AVX2_BIT
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<int64, aligned_lowp>::tvec4(int64 s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_lowp>::tvec4(int64 s) :
data(_mm256_set1_epi64x(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<int64, aligned_mediump>::tvec4(int64 s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_mediump>::tvec4(int64 s) :
data(_mm256_set1_epi64x(s))
{}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<int64, aligned_highp>::tvec4(int64 s) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_highp>::tvec4(int64 s) :
data(_mm256_set1_epi64x(s))
{}
# endif
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, aligned_lowp>::tvec4(float a, float b, float c, float d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::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<float, aligned_mediump>::tvec4(float a, float b, float c, float d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::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<float, aligned_highp>::tvec4(float a, float b, float c, float d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::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<int32, aligned_lowp>::tvec4(int32 a, int32 b, int32 c, int32 d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_lowp>::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<int32, aligned_mediump>::tvec4(int32 a, int32 b, int32 c, int32 d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_mediump>::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<int32, aligned_highp>::tvec4(int32 a, int32 b, int32 c, int32 d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_highp>::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<float, aligned_lowp>::tvec4(int32 a, int32 b, int32 c, int32 d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::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<float, aligned_mediump>::tvec4(int32 a, int32 b, int32 c, int32 d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::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<float, aligned_highp>::tvec4(int32 a, int32 b, int32 c, int32 d) :
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec4(int32 a, int32 b, int32 c, int32 d) :
data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a)))
{}
}//namespace glm