Improved GTC_type_precision and added issues regarding SIMD and constexpr interaction #653

This commit is contained in:
Christophe Riccio
2017-08-16 22:35:29 +02:00
parent cdb28edcaa
commit 22fe828159
5 changed files with 413 additions and 113 deletions

View File

@@ -104,6 +104,17 @@ static int test_vec4_ctor()
}
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE
{
constexpr glm::ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
# endif
{
glm::vec4 A(1);
glm::vec4 B(1, 1, 1, 1);
@@ -577,11 +588,14 @@ int main()
*/
# ifdef NDEBUG
std::size_t const Size(1000000);
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);
std::size_t const Size(1000000);
# else
std::size_t const Size(1);
# endif//NDEBUG
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);
Error += test_vec4_ctor();
Error += test_bvec4_ctor();
Error += test_vec4_size();

View File

@@ -60,7 +60,7 @@ struct my_u8vec4_packed
};
GLM_STATIC_ASSERT(sizeof(my_u8vec4_packed) == sizeof(glm::uint32) + sizeof(glm::u8vec4), "glm::u8vec4 packed is not correct");
int test_copy()
static int test_copy()
{
int Error = 0;
@@ -90,6 +90,42 @@ int test_copy()
return Error;
}
static int test_ctor()
{
int Error = 0;
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE
{
constexpr glm::aligned_ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
{
constexpr glm::packed_ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
{
constexpr glm::ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
# endif
return Error;
}
int main()
{
int Error = 0;
@@ -105,6 +141,8 @@ int main()
std::size_t B1 = sizeof(my_vec4_packed);
std::size_t C1 = sizeof(glm::aligned_vec4);
Error += test_ctor();
return Error;
}