From f56011fb20971eecc8abdf17e09f3d30e5fffe54 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 27 Aug 2018 22:11:17 +0200 Subject: [PATCH] Fixed aligned test on compilers that doesn't support it --- glm/detail/setup.hpp | 5 +++++ test/core/core_type_aligned.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index d57cc557..2497e7ed 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -1000,6 +1000,11 @@ namespace detail # pragma message("GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types") # endif +# if defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE) +# undef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES +# pragma message("GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions") +# endif + # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.") # else diff --git a/test/core/core_type_aligned.cpp b/test/core/core_type_aligned.cpp index 48dd91d0..dff0939c 100644 --- a/test/core/core_type_aligned.cpp +++ b/test/core/core_type_aligned.cpp @@ -1,9 +1,9 @@ #define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES #include -#if GLM_HAS_ALIGNOF +#if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE #include -/* + static_assert(sizeof(glm::bvec4) > sizeof(glm::bvec2), "Invalid sizeof"); static_assert(sizeof(glm::ivec4) > sizeof(glm::uvec2), "Invalid sizeof"); static_assert(sizeof(glm::dvec4) > sizeof(glm::dvec2), "Invalid sizeof"); @@ -11,7 +11,7 @@ static_assert(sizeof(glm::dvec4) > sizeof(glm::dvec2), "Invalid sizeof"); static_assert(sizeof(glm::bvec4) == sizeof(glm::bvec3), "Invalid sizeof"); static_assert(sizeof(glm::uvec4) == sizeof(glm::uvec3), "Invalid sizeof"); static_assert(sizeof(glm::dvec4) == sizeof(glm::dvec3), "Invalid sizeof"); -*/ + static int test_storage_aligned() { int Error = 0; @@ -82,7 +82,7 @@ int main() { int Error = 0; -# if GLM_HAS_ALIGNOF +# if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE Error += test_storage_aligned(); Error += test_storage_unaligned(); Error += test_vec3_aligned();