diff --git a/glm/detail/precision.hpp b/glm/detail/precision.hpp index d3ced27f..7980dbdc 100644 --- a/glm/detail/precision.hpp +++ b/glm/detail/precision.hpp @@ -7,18 +7,23 @@ namespace glm { enum precision { - aligned_highp, - aligned_mediump, - aligned_lowp, packed_highp, packed_mediump, packed_lowp, - aligned = aligned_highp, - packed = packed_highp, + +# if GLM_HAS_ALIGNED_TYPE + aligned_highp, + aligned_mediump, + aligned_lowp, + aligned = aligned_highp, +# endif + highp = packed_highp, mediump = packed_mediump, lowp = packed_lowp, -# ifdef GLM_FORCE_ALIGNED + packed = packed_highp, + +# if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED) defaultp = aligned_highp # else defaultp = highp @@ -33,22 +38,24 @@ namespace detail static const bool value = false; }; - template<> - struct is_aligned - { - static const bool value = true; - }; +# if GLM_HAS_ALIGNED_TYPE + template<> + struct is_aligned + { + static const bool value = true; + }; - template<> - struct is_aligned - { - static const bool value = true; - }; + template<> + struct is_aligned + { + static const bool value = true; + }; - template<> - struct is_aligned - { - static const bool value = true; - }; + template<> + struct is_aligned + { + static const bool value = true; + }; +# endif }//namespace detail }//namespace glm diff --git a/glm/ext.hpp b/glm/ext.hpp index 59476b0a..dee032e3 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -50,6 +50,9 @@ #include "./gtc/type_ptr.hpp" #include "./gtc/ulp.hpp" #include "./gtc/vec1.hpp" +#if GLM_HAS_ALIGNED_TYPE +# include "./gtc/type_aligned.hpp" +#endif #include "./gtx/associated_min_max.hpp" #include "./gtx/bit.hpp" @@ -95,7 +98,6 @@ #endif #include "./gtx/transform.hpp" #include "./gtx/transform2.hpp" -#include "./gtx/type_aligned.hpp" #include "./gtx/vector_angle.hpp" #include "./gtx/vector_query.hpp" #include "./gtx/wrap.hpp" diff --git a/glm/gtc/type_aligned.hpp b/glm/gtc/type_aligned.hpp index 14603434..d143bcf3 100644 --- a/glm/gtc/type_aligned.hpp +++ b/glm/gtc/type_aligned.hpp @@ -1,5 +1,21 @@ /// @ref gtc_type_aligned /// @file glm/gtc/type_aligned.hpp +/// +/// @see core (dependence) +/// +/// @defgroup gtc_type_aligned GLM_GTC_type_aligned +/// @ingroup gtc +/// +/// @brief Aligned types. +/// need to be included to use these features. + +#if !GLM_HAS_ALIGNED_TYPE +# error "GLM: Aligned types are not supported on this platform" +#endif + +#if(defined(GLM_MESSAGES) && !defined(glm_ext)) +# pragma message("GLM: GLM_GTC_type_aligned extension included") +#endif #pragma once diff --git a/test/gtc/gtc_type_aligned.cpp b/test/gtc/gtc_type_aligned.cpp index e2d7005d..351a3958 100644 --- a/test/gtc/gtc_type_aligned.cpp +++ b/test/gtc/gtc_type_aligned.cpp @@ -1,5 +1,7 @@ #define GLM_MESSAGES -#define GLM_FORCE_ALIGNED +#include + +#if GLM_HAS_ALIGNED_TYPE #include GLM_STATIC_ASSERT(glm::detail::is_aligned::value, "aligned_lowp is not aligned"); @@ -21,9 +23,7 @@ struct my_vec4_aligned glm::uint32 a; glm::aligned_vec4 b; }; -#if GLM_HAS_ALIGNED_TYPE - GLM_STATIC_ASSERT(sizeof(my_vec4_aligned) == sizeof(glm::aligned_vec4) * 2, "glm::vec4 aligned is not correct"); -#endif +GLM_STATIC_ASSERT(sizeof(my_vec4_aligned) == sizeof(glm::aligned_vec4) * 2, "glm::vec4 aligned is not correct"); struct my_dvec4_packed { @@ -51,9 +51,7 @@ struct my_ivec4_aligned glm::uint32 a; glm::aligned_ivec4 b; }; -#if GLM_HAS_ALIGNED_TYPE - GLM_STATIC_ASSERT(sizeof(my_ivec4_aligned) == sizeof(glm::aligned_ivec4) * 2, "glm::ivec4 aligned is not correct"); -#endif +GLM_STATIC_ASSERT(sizeof(my_ivec4_aligned) == sizeof(glm::aligned_ivec4) * 2, "glm::ivec4 aligned is not correct"); struct my_u8vec4_packed { @@ -92,7 +90,6 @@ int test_copy() return Error; } - int main() { int Error = 0; @@ -110,3 +107,12 @@ int main() return Error; } + +#else + +int main() +{ + return 0; +} + +#endif//GLM_HAS_ALIGNED_TYPE