|
|
@@ -16,6 +16,7 @@
|
|
|
|
|
|
// This file has divisions by zero to test isnan
|
|
|
#if GLM_COMPILER & GLM_COMPILER_VC
|
|
|
+# pragma warning(push)
|
|
|
# pragma warning(disable : 4723)
|
|
|
#endif
|
|
|
|
|
|
@@ -297,12 +298,12 @@ namespace min_
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
- int min_tern(int a, int b)
|
|
|
+ static int min_tern(int a, int b)
|
|
|
{
|
|
|
return a < b ? a : b;
|
|
|
}
|
|
|
|
|
|
- int min_int(int x, int y)
|
|
|
+ static int min_int(int x, int y)
|
|
|
{
|
|
|
return y ^ ((x ^ y) & -(x < y));
|
|
|
}
|
|
|
@@ -396,6 +397,11 @@ namespace clamp_
|
|
|
|
|
|
namespace mix_
|
|
|
{
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic push
|
|
|
+# pragma clang diagnostic ignored "-Wpadded"
|
|
|
+#endif
|
|
|
+
|
|
|
template<typename T, typename B>
|
|
|
struct entry
|
|
|
{
|
|
|
@@ -405,7 +411,16 @@ namespace mix_
|
|
|
T Result;
|
|
|
};
|
|
|
|
|
|
- entry<float, bool> const TestBool[] =
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic pop
|
|
|
+#endif
|
|
|
+
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic push
|
|
|
+# pragma clang diagnostic ignored "-Wglobal-constructors"
|
|
|
+#endif
|
|
|
+
|
|
|
+ static entry<float, bool> const TestBool[] =
|
|
|
{
|
|
|
{0.0f, 1.0f, false, 0.0f},
|
|
|
{0.0f, 1.0f, true, 1.0f},
|
|
|
@@ -413,7 +428,7 @@ namespace mix_
|
|
|
{-1.0f, 1.0f, true, 1.0f}
|
|
|
};
|
|
|
|
|
|
- entry<float, float> const TestFloat[] =
|
|
|
+ static entry<float, float> const TestFloat[] =
|
|
|
{
|
|
|
{0.0f, 1.0f, 0.0f, 0.0f},
|
|
|
{0.0f, 1.0f, 1.0f, 1.0f},
|
|
|
@@ -421,7 +436,7 @@ namespace mix_
|
|
|
{-1.0f, 1.0f, 1.0f, 1.0f}
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec2, bool> const TestVec2Bool[] =
|
|
|
+ static entry<glm::vec2, bool> const TestVec2Bool[] =
|
|
|
{
|
|
|
{glm::vec2(0.0f), glm::vec2(1.0f), false, glm::vec2(0.0f)},
|
|
|
{glm::vec2(0.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)},
|
|
|
@@ -429,7 +444,7 @@ namespace mix_
|
|
|
{glm::vec2(-1.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)}
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec2, glm::bvec2> const TestBVec2[] =
|
|
|
+ static entry<glm::vec2, glm::bvec2> const TestBVec2[] =
|
|
|
{
|
|
|
{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(0.0f)},
|
|
|
{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)},
|
|
|
@@ -438,7 +453,7 @@ namespace mix_
|
|
|
{glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(true, false), glm::vec2(1.0f, -1.0f)}
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec3, bool> const TestVec3Bool[] =
|
|
|
+ static entry<glm::vec3, bool> const TestVec3Bool[] =
|
|
|
{
|
|
|
{glm::vec3(0.0f), glm::vec3(1.0f), false, glm::vec3(0.0f)},
|
|
|
{glm::vec3(0.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)},
|
|
|
@@ -446,7 +461,7 @@ namespace mix_
|
|
|
{glm::vec3(-1.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)}
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec3, glm::bvec3> const TestBVec3[] =
|
|
|
+ static entry<glm::vec3, glm::bvec3> const TestBVec3[] =
|
|
|
{
|
|
|
{glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(false), glm::vec3(0.0f)},
|
|
|
{glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(true), glm::vec3(1.0f)},
|
|
|
@@ -455,7 +470,7 @@ namespace mix_
|
|
|
{glm::vec3(1.0f, 2.0f, 3.0f), glm::vec3(4.0f, 5.0f, 6.0f), glm::bvec3(true, false, true), glm::vec3(4.0f, 2.0f, 6.0f)}
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec4, bool> const TestVec4Bool[] =
|
|
|
+ static entry<glm::vec4, bool> const TestVec4Bool[] =
|
|
|
{
|
|
|
{glm::vec4(0.0f), glm::vec4(1.0f), false, glm::vec4(0.0f)},
|
|
|
{glm::vec4(0.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)},
|
|
|
@@ -463,7 +478,7 @@ namespace mix_
|
|
|
{glm::vec4(-1.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)}
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec4, glm::bvec4> const TestBVec4[] =
|
|
|
+ static entry<glm::vec4, glm::bvec4> const TestBVec4[] =
|
|
|
{
|
|
|
{glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), glm::vec4(2.0f, 2.0f, 3.0f, 3.0f), glm::bvec4(false, true, false, true), glm::vec4(0.0f, 2.0f, 1.0f, 3.0f)},
|
|
|
{glm::vec4(0.0f), glm::vec4(1.0f), glm::bvec4(true), glm::vec4(1.0f)},
|
|
|
@@ -472,6 +487,10 @@ namespace mix_
|
|
|
{glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(5.0f, 6.0f, 7.0f, 8.0f), glm::bvec4(true, false, true, false), glm::vec4(5.0f, 2.0f, 7.0f, 4.0f)}
|
|
|
};
|
|
|
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic pop
|
|
|
+#endif
|
|
|
+
|
|
|
static int test()
|
|
|
{
|
|
|
int Error = 0;
|
|
|
@@ -574,14 +593,19 @@ namespace step_
|
|
|
VEC result;
|
|
|
};
|
|
|
|
|
|
- entry<float, glm::vec4> TestVec4Scalar [] =
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic push
|
|
|
+# pragma clang diagnostic ignored "-Wglobal-constructors"
|
|
|
+#endif
|
|
|
+
|
|
|
+ static const entry<float, glm::vec4> TestVec4Scalar [] =
|
|
|
{
|
|
|
{ 1.0f, glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) },
|
|
|
{ 0.0f, glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) },
|
|
|
{ 0.0f, glm::vec4(-1.0f, -2.0f, -3.0f, -4.0f), glm::vec4(0.0f) }
|
|
|
};
|
|
|
|
|
|
- entry<glm::vec4, glm::vec4> TestVec4Vector [] =
|
|
|
+ static const entry<glm::vec4, glm::vec4> TestVec4Vector [] =
|
|
|
{
|
|
|
{ glm::vec4(-1.0f, -2.0f, -3.0f, -4.0f), glm::vec4(-2.0f, -3.0f, -4.0f, -5.0f), glm::vec4(0.0f) },
|
|
|
{ glm::vec4( 0.0f, 1.0f, 2.0f, 3.0f), glm::vec4( 1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) },
|
|
|
@@ -589,6 +613,10 @@ namespace step_
|
|
|
{ glm::vec4( 0.0f, 1.0f, 2.0f, 3.0f), glm::vec4(-1.0f,-2.0f,-3.0f,-4.0f), glm::vec4(0.0f) }
|
|
|
};
|
|
|
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic pop
|
|
|
+#endif
|
|
|
+
|
|
|
static int test()
|
|
|
{
|
|
|
int Error = 0;
|
|
|
@@ -900,6 +928,11 @@ namespace sign
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic push
|
|
|
+# pragma clang diagnostic ignored "-Wsign-conversion"
|
|
|
+#endif
|
|
|
+
|
|
|
template<typename genFIType>
|
|
|
GLM_FUNC_QUALIFIER genFIType sign_alu1(genFIType x)
|
|
|
{
|
|
|
@@ -910,6 +943,10 @@ namespace sign
|
|
|
return (x >> 31) | (static_cast<unsigned>(-x) >> 31);
|
|
|
}
|
|
|
|
|
|
+#if GLM_COMPILER & GLM_COMPILER_CLANG
|
|
|
+# pragma clang diagnostic pop
|
|
|
+#endif
|
|
|
+
|
|
|
GLM_FUNC_QUALIFIER int sign_alu2(int x)
|
|
|
{
|
|
|
GLM_STATIC_ASSERT(std::numeric_limits<int>::is_signed && std::numeric_limits<int>::is_integer, "'sign' only accept integer inputs");
|
|
|
@@ -953,7 +990,7 @@ namespace sign
|
|
|
genType Return;
|
|
|
};
|
|
|
|
|
|
- int test_int32()
|
|
|
+ static int test_int32()
|
|
|
{
|
|
|
type<glm::int32> const Data[] =
|
|
|
{
|
|
|
@@ -1003,7 +1040,7 @@ namespace sign
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
- int test_i32vec4()
|
|
|
+ static int test_i32vec4()
|
|
|
{
|
|
|
type<glm::ivec4> const Data[] =
|
|
|
{
|
|
|
@@ -1027,7 +1064,7 @@ namespace sign
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
- int test_f32vec4()
|
|
|
+ static int test_f32vec4()
|
|
|
{
|
|
|
type<glm::vec4> const Data[] =
|
|
|
{
|
|
|
@@ -1062,7 +1099,7 @@ namespace sign
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
- int perf_rand(std::size_t Samples)
|
|
|
+ static int perf_rand(std::size_t Samples)
|
|
|
{
|
|
|
int Error = 0;
|
|
|
|
|
|
@@ -1115,7 +1152,7 @@ namespace sign
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
- int perf_linear(std::size_t Samples)
|
|
|
+ static int perf_linear(std::size_t Samples)
|
|
|
{
|
|
|
int Error = 0;
|
|
|
|
|
|
@@ -1162,7 +1199,7 @@ namespace sign
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
- int perf_linear_cal(std::size_t Samples)
|
|
|
+ static int perf_linear_cal(std::size_t Samples)
|
|
|
{
|
|
|
int Error = 0;
|
|
|
|
|
|
@@ -1265,7 +1302,7 @@ namespace ldexp_
|
|
|
{
|
|
|
static int test()
|
|
|
{
|
|
|
- int Error(0);
|
|
|
+ int Error = 0;
|
|
|
|
|
|
{
|
|
|
glm::vec1 A = glm::vec1(0.5);
|
|
|
@@ -1307,6 +1344,11 @@ static int test_constexpr()
|
|
|
constexpr glm::vec2 const B = glm::abs(glm::vec2(1.0f));
|
|
|
constexpr glm::vec3 const C = glm::abs(glm::vec3(1.0f));
|
|
|
constexpr glm::vec4 const D = glm::abs(glm::vec4(1.0f));
|
|
|
+
|
|
|
+ static_assert(glm::all(glm::equal(A, glm::vec1(1.0f), glm::epsilon<float>())), "GLM: Failed constexpr");
|
|
|
+ static_assert(glm::all(glm::equal(B, glm::vec2(1.0f), glm::epsilon<float>())), "GLM: Failed constexpr");
|
|
|
+ static_assert(glm::all(glm::equal(C, glm::vec3(1.0f), glm::epsilon<float>())), "GLM: Failed constexpr");
|
|
|
+ static_assert(glm::all(glm::equal(D, glm::vec4(1.0f), glm::epsilon<float>())), "GLM: Failed constexpr");
|
|
|
#endif // GLM_HAS_CONSTEXPR
|
|
|
|
|
|
return 0;
|
|
|
@@ -1347,3 +1389,6 @@ int main()
|
|
|
return Error;
|
|
|
}
|
|
|
|
|
|
+#if(GLM_COMPILER & GLM_COMPILER_VC)
|
|
|
+# pragma warning(pop)
|
|
|
+#endif
|