Fixed build

This commit is contained in:
Groove 2018-07-11 22:45:18 +02:00
parent b76f938505
commit 5620858a14
17 changed files with 64 additions and 50 deletions

View File

@ -30,7 +30,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see qualifier
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 genType abs(genType x);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 genType abs(genType x);
/// Returns x if x >= 0; otherwise, it returns -x.
///
@ -41,7 +41,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 vec<L, T, Q> abs(vec<L, T, Q> const& x);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<L, T, Q> abs(vec<L, T, Q> const& x);
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
///

View File

@ -13,7 +13,7 @@ namespace detail
template<typename genFIType>
struct compute_abs<genFIType, true>
{
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 static genFIType call(genFIType x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static genFIType call(genFIType x)
{
GLM_STATIC_ASSERT(
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed || GLM_UNRESTRICTED_GENTYPE,
@ -28,7 +28,7 @@ namespace detail
template<>
struct compute_abs<float, true>
{
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 static float call(float x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static float call(float x)
{
return fabsf(x);
}
@ -38,7 +38,7 @@ namespace detail
template<typename genFIType>
struct compute_abs<genFIType, false>
{
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 static genFIType call(genFIType x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static genFIType call(genFIType x)
{
GLM_STATIC_ASSERT(
(!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer) || GLM_UNRESTRICTED_GENTYPE,

View File

@ -10,7 +10,7 @@ namespace detail
template <typename T, bool isFloat>
struct compute_equal
{
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 static bool call(T a, T b)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static bool call(T a, T b)
{
return a == b;
}
@ -19,7 +19,7 @@ namespace detail
template <typename T>
struct compute_equal<T, true>
{
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 static bool call(T a, T b)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static bool call(T a, T b)
{
return detail::compute_abs<T, std::numeric_limits<T>::is_signed>::call(b - a) <= static_cast<T>(0);
//return std::memcmp(&a, &b, sizeof(T)) == 0;

View File

@ -30,7 +30,7 @@ namespace glm
// abs
template<>
GLM_FUNC_QUALIFIER int32 abs(int32 x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 int32 abs(int32 x)
{
int32 const y = x >> 31;
return (x ^ y) - y;
@ -266,13 +266,13 @@ namespace detail
}//namespace detail
template<typename genFIType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 genFIType abs(genFIType x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 genFIType abs(genFIType x)
{
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<L, T, Q> abs(vec<L, T, Q> const& x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<L, T, Q> abs(vec<L, T, Q> const& x)
{
return detail::compute_abs_vector<L, T, Q, detail::is_aligned<Q>::value>::call(x);
}

View File

@ -527,25 +527,25 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return detail::compute_equal<T, std::numeric_limits<T>::is_iec559>::call(v1.x, v2.x);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return !(v1 == v2);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2)
{
return vec<1, bool, Q>(v1.x && v2.x);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2)
{
return vec<1, bool, Q>(v1.x || v2.x);
}

View File

@ -361,16 +361,16 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL bool operator==(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator==(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL bool operator!=(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator!=(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<2, bool, Q> operator&&(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<2, bool, Q> operator&&(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<2, bool, Q> operator||(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<2, bool, Q> operator||(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -873,7 +873,7 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER bool operator==(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator==(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{
return
detail::compute_equal<T, std::numeric_limits<T>::is_iec559>::call(v1.x, v2.x) &&
@ -881,19 +881,19 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER bool operator!=(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator!=(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{
return !(v1 == v2);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<2, bool, Q> operator&&(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<2, bool, Q> operator&&(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2)
{
return vec<2, bool, Q>(v1.x && v2.x, v1.y && v2.y);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<2, bool, Q> operator||(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<2, bool, Q> operator||(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2)
{
return vec<2, bool, Q>(v1.x || v2.x, v1.y || v2.y);
}

View File

@ -391,16 +391,16 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 bool operator==(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator==(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 bool operator!=(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator!=(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<3, bool, Q> operator&&(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<3, bool, Q> operator&&(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<3, bool, Q> operator||(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<3, bool, Q> operator||(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -1021,7 +1021,7 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 bool operator==(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator==(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2)
{
return
detail::compute_equal<T, std::numeric_limits<T>::is_iec559>::call(v1.x, v2.x) &&
@ -1030,19 +1030,19 @@ namespace glm
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 bool operator!=(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator!=(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2)
{
return !(v1 == v2);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<3, bool, Q> operator&&(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<3, bool, Q> operator&&(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2)
{
return vec<3, bool, Q>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<3, bool, Q> operator||(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<3, bool, Q> operator||(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2)
{
return vec<3, bool, Q>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z);
}

View File

@ -466,16 +466,16 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL bool operator==(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator==(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL bool operator!=(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator!=(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> operator&&(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<4, bool, Q> operator&&(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> operator||(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<4, bool, Q> operator||(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -127,7 +127,7 @@ namespace detail
template<typename T, qualifier Q, int IsInt, std::size_t Size, bool Aligned>
struct compute_vec4_equal
{
GLM_FUNC_QUALIFIER static bool call(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static bool call(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
{
return
detail::compute_equal<T, std::numeric_limits<T>::is_iec559>::call(v1.x, v2.x) &&
@ -140,7 +140,7 @@ namespace detail
template<typename T, qualifier Q, int IsInt, std::size_t Size, bool Aligned>
struct compute_vec4_nequal
{
GLM_FUNC_QUALIFIER static bool call(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static bool call(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
{
return !compute_vec4_equal<T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
}
@ -1118,25 +1118,25 @@ namespace detail
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER bool operator==(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator==(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
{
return detail::compute_vec4_equal<T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER bool operator!=(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 bool operator!=(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
{
return detail::compute_vec4_nequal<T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> operator&&(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<4, bool, Q> operator&&(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2)
{
return vec<4, bool, Q>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w);
}
template<qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> operator||(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 vec<4, bool, Q> operator||(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2)
{
return vec<4, bool, Q>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w);
}

View File

@ -285,16 +285,16 @@ namespace glm
// -- Boolean operators --
template<typename T, qualifier Q>
GLM_FUNC_DECL bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q>
GLM_FUNC_DECL bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);
template<qualifier Q>
GLM_FUNC_DECL vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);
GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);
/// 1 component vector of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///

View File

@ -1291,10 +1291,13 @@ namespace ldexp_
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
#if GLM_HAS_CONSTEXPR_CXX14
static_assert(glm::abs(1.0f) > 0.0f, "GLM: Failed constexpr");
static_assert(glm::abs(glm::vec1(1.0f)) != glm::vec1(0.0f), "GLM: Failed constexpr");
static_assert(glm::abs(glm::vec2(1.0f)) != glm::vec2(0.0f), "GLM: Failed constexpr");
static_assert(glm::abs(glm::vec3(1.0f)) != glm::vec3(0.0f), "GLM: Failed constexpr");
#endif // GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::abs(glm::vec4(1.0f)) != glm::vec4(0.0f), "GLM: Failed constexpr");
#endif // GLM_HAS_CONSTEXPR_CXX14
return 0;
}

View File

@ -137,6 +137,16 @@ static int test_vec1_operator_increment()
return Error;
}
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX14
static_assert(glm::vec1::length() == 1, "GLM: Failed constexpr");
static_assert(glm::vec1(1.0f).x > 0.0f, "GLM: Failed constexpr");
#endif
return 0;
}
int main()
{
int Error = 0;
@ -145,6 +155,7 @@ int main()
Error += test_vec1_ctor();
Error += test_vec1_operators();
Error += test_vec1_operator_increment();
Error += test_constexpr();
return Error;
}

View File

@ -347,7 +347,7 @@ static int test_operator_increment()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
#if GLM_HAS_CONSTEXPR_CXX14
static_assert(glm::vec2::length() == 2, "GLM: Failed constexpr");
static_assert(glm::vec2(1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec2(1.0f, -1.0f).x > 0.0f, "GLM: Failed constexpr");

View File

@ -564,7 +564,7 @@ static int test_operator_increment()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
#if GLM_HAS_CONSTEXPR_CXX14
static_assert(glm::vec3::length() == 3, "GLM: Failed constexpr");
static_assert(glm::vec3(1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec3(1.0f) == glm::vec3(1.0f), "GLM: Failed constexpr");

View File

@ -711,10 +711,10 @@ static int test_inheritance()
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
#if GLM_HAS_CONSTEXPR_CXX14
static_assert(glm::vec4::length() == 4, "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f).x > 0.0f, "GLM: Failed constexpr");
//static_assert(glm::vec4(1.0f) == glm::vec4(1.0f), "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f) == glm::vec4(1.0f), "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f, -1.0f, -1.0f, -1.0f).x > 0.0f, "GLM: Failed constexpr");
static_assert(glm::vec4(1.0f, -1.0f, -1.0f, -1.0f).y < 0.0f, "GLM: Failed constexpr");
#endif