Merge 0.9.8 branch

master
Christophe Riccio ago%!(EXTRA string=9 years)
commit ecc91d4361
  1. 1
      CMakeLists.txt
  2. 9
      glm/detail/func_integer.inl
  3. 65
      glm/detail/precision.hpp
  4. 4
      glm/detail/setup.hpp
  5. 2
      glm/detail/type_int.hpp
  6. 29
      glm/detail/type_vec.hpp
  7. 6
      glm/detail/type_vec1.hpp
  8. 4
      glm/detail/type_vec2.hpp
  9. 6
      glm/detail/type_vec3.hpp
  10. 5
      glm/detail/type_vec4.hpp
  11. 2
      glm/detail/type_vec4.inl
  12. 2
      glm/detail/type_vec4_simd.inl
  13. 4
      glm/ext.hpp
  14. 4
      glm/gtc/quaternion.hpp
  15. 2
      glm/gtc/quaternion.inl
  16. 16
      glm/gtc/type_aligned.hpp
  17. 23
      test/gtc/gtc_type_aligned.cpp
  18. 8
      test/gtx/gtx_io.cpp

@ -89,6 +89,7 @@ else()
add_definitions(/Za) add_definitions(/Za)
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")) elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
add_definitions(-pedantic) add_definitions(-pedantic)
add_definitions(-pedantic)
endif() endif()
endif() endif()

@ -12,6 +12,15 @@
#endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC) #endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
#include <limits> #include <limits>
#if !GLM_HAS_EXTENDED_INTEGER_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
# pragma clang diagnostic ignored "-Wc++11-long-long"
# endif
#endif
namespace glm{ namespace glm{
namespace detail namespace detail
{ {

@ -3,52 +3,61 @@
#pragma once #pragma once
#include "setup.hpp"
namespace glm namespace glm
{ {
enum precision enum precision
{ {
highp, packed_highp,
mediump, packed_mediump,
lowp, packed_lowp,
aligned_highp,
aligned_mediump, # if GLM_HAS_ALIGNED_TYPE
aligned_lowp, aligned_highp,
packed_highp = highp, aligned_mediump,
packed_mediump = mediump, aligned_lowp,
packed_lowp = lowp, aligned = aligned_highp,
# endif
highp = packed_highp,
mediump = packed_mediump,
lowp = packed_lowp,
packed = packed_highp, packed = packed_highp,
aligned = aligned_highp,
# ifdef GLM_FORCE_ALIGNED # if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED)
defaultp = aligned_highp defaultp = aligned_highp
# else # else
defaultp = highp defaultp = highp
# endif # endif
}; };
namespace detail namespace detail
{ {
template <precision P> template <glm::precision P>
struct is_aligned struct is_aligned
{ {
static const bool value = false; static const bool value = false;
}; };
template<> # if GLM_HAS_ALIGNED_TYPE
struct is_aligned<aligned_lowp> template<>
{ struct is_aligned<glm::aligned_lowp>
static const bool value = true; {
}; static const bool value = true;
};
template<> template<>
struct is_aligned<aligned_mediump> struct is_aligned<glm::aligned_mediump>
{ {
static const bool value = true; static const bool value = true;
}; };
template<> template<>
struct is_aligned<aligned_highp> struct is_aligned<glm::aligned_highp>
{ {
static const bool value = true; static const bool value = true;
}; };
# endif
}//namespace detail }//namespace detail
}//namespace glm }//namespace glm

@ -647,6 +647,10 @@
# define GLM_EXPLICIT # define GLM_EXPLICIT
#endif #endif
///////////////////////////////////////////////////////////////////////////////////
#define GLM_HAS_ALIGNED_TYPE GLM_HAS_UNRESTRICTED_UNIONS
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Length type // Length type

@ -35,7 +35,7 @@ namespace detail
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
# elif GLM_COMPILER & GLM_COMPILER_GCC # elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic ignored "-Wno-long-long" # pragma GCC diagnostic ignored "-Wlong-long"
__extension__ typedef signed long long sint64; __extension__ typedef signed long long sint64;
__extension__ typedef unsigned long long uint64; __extension__ typedef unsigned long long uint64;

@ -16,7 +16,7 @@ namespace detail
uint8 data[size]; uint8 data[size];
} type; } type;
}; };
/*
template <typename T, std::size_t size> template <typename T, std::size_t size>
struct storage<T, size, true> struct storage<T, size, true>
{ {
@ -24,7 +24,7 @@ namespace detail
uint8 data[size]; uint8 data[size];
} type; } type;
}; };
*/
# if GLM_ARCH & GLM_ARCH_SSE2_BIT # if GLM_ARCH & GLM_ARCH_SSE2_BIT
template <> template <>
struct storage<float, 16, true> struct storage<float, 16, true>
@ -43,6 +43,31 @@ namespace detail
{ {
typedef glm_uvec4 type; typedef glm_uvec4 type;
}; };
/*
# else
typedef union __declspec(align(16)) glm_128
{
unsigned __int8 data[16];
} glm_128;
template <>
struct storage<float, 16, true>
{
typedef glm_128 type;
};
template <>
struct storage<int, 16, true>
{
typedef glm_128 type;
};
template <>
struct storage<unsigned int, 16, true>
{
typedef glm_128 type;
};
*/
# endif # endif
# if (GLM_ARCH & GLM_ARCH_AVX_BIT) # if (GLM_ARCH & GLM_ARCH_AVX_BIT)

@ -21,16 +21,16 @@ namespace glm
{ {
// -- Implementation detail -- // -- Implementation detail --
typedef T value_type;
typedef tvec1<T, P> type; typedef tvec1<T, P> type;
typedef tvec1<bool, P> bool_type; typedef tvec1<bool, P> bool_type;
typedef T value_type;
// -- Data -- // -- Data --
# if GLM_HAS_UNRESTRICTED_UNIONS && (defined(GLM_SWIZZLE) || (GLM_ARCH & (GLM_ARCH_SSE2_BIT | GLM_ARCH_NEON_BIT))) # if GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-pedantic"
# endif # endif
# if GLM_COMPILER & GLM_COMPILER_CLANG # if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push # pragma clang diagnostic push

@ -26,10 +26,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_UNRESTRICTED_UNIONS && (defined(GLM_SWIZZLE) || (GLM_ARCH & (GLM_ARCH_SSE2_BIT | GLM_ARCH_NEON_BIT))) # if GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-pedantic"
# endif # endif
# if GLM_COMPILER & GLM_COMPILER_CLANG # if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push # pragma clang diagnostic push

@ -20,16 +20,16 @@ namespace glm
{ {
// -- Implementation detail -- // -- Implementation detail --
typedef T value_type;
typedef tvec3<T, P> type; typedef tvec3<T, P> type;
typedef tvec3<bool, P> bool_type; typedef tvec3<bool, P> bool_type;
typedef T value_type;
// -- Data -- // -- Data --
# if GLM_HAS_UNRESTRICTED_UNIONS && (defined(GLM_SWIZZLE) || (GLM_ARCH & (GLM_ARCH_SSE2_BIT | GLM_ARCH_NEON_BIT))) # if GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-pedantic"
# endif # endif
# if GLM_COMPILER & GLM_COMPILER_CLANG # if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push # pragma clang diagnostic push

@ -3,7 +3,6 @@
#pragma once #pragma once
#include "setup.hpp"
#include "type_vec.hpp" #include "type_vec.hpp"
#ifdef GLM_SWIZZLE #ifdef GLM_SWIZZLE
# if GLM_HAS_ANONYMOUS_UNION # if GLM_HAS_ANONYMOUS_UNION
@ -27,10 +26,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_UNRESTRICTED_UNIONS && (defined(GLM_SWIZZLE) || (GLM_ARCH & (GLM_ARCH_SSE2_BIT | GLM_ARCH_NEON_BIT))) # if GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-pedantic"
# endif # endif
# if GLM_COMPILER & GLM_COMPILER_CLANG # if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push # pragma clang diagnostic push

@ -970,6 +970,6 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS #if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ALIGNED_TYPE
# include "type_vec4_simd.inl" # include "type_vec4_simd.inl"
#endif #endif

@ -49,7 +49,7 @@ namespace detail
return Result; return Result;
} }
}; };
# endif # endif//GLM_SWIZZLE
template <precision P> template <precision P>
struct compute_vec4_add<float, P, true> struct compute_vec4_add<float, P, true>

@ -50,6 +50,9 @@
#include "./gtc/type_ptr.hpp" #include "./gtc/type_ptr.hpp"
#include "./gtc/ulp.hpp" #include "./gtc/ulp.hpp"
#include "./gtc/vec1.hpp" #include "./gtc/vec1.hpp"
#if GLM_HAS_ALIGNED_TYPE
# include "./gtc/type_aligned.hpp"
#endif
#include "./gtx/associated_min_max.hpp" #include "./gtx/associated_min_max.hpp"
#include "./gtx/bit.hpp" #include "./gtx/bit.hpp"
@ -95,7 +98,6 @@
#endif #endif
#include "./gtx/transform.hpp" #include "./gtx/transform.hpp"
#include "./gtx/transform2.hpp" #include "./gtx/transform2.hpp"
#include "./gtx/type_aligned.hpp"
#include "./gtx/vector_angle.hpp" #include "./gtx/vector_angle.hpp"
#include "./gtx/vector_query.hpp" #include "./gtx/vector_query.hpp"
#include "./gtx/wrap.hpp" #include "./gtx/wrap.hpp"

@ -40,10 +40,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_UNRESTRICTED_UNIONS && (defined(GLM_SWIZZLE) || (GLM_ARCH & (GLM_ARCH_SSE2_BIT | GLM_ARCH_NEON_BIT))) # if GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-pedantic"
# endif # endif
# if GLM_COMPILER & GLM_COMPILER_CLANG # if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push # pragma clang diagnostic push

@ -795,7 +795,7 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS #if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ALIGNED_TYPE
# include "quaternion_simd.inl" # include "quaternion_simd.inl"
#endif #endif

@ -1,5 +1,21 @@
/// @ref gtc_type_aligned /// @ref gtc_type_aligned
/// @file glm/gtc/type_aligned.hpp /// @file glm/gtc/type_aligned.hpp
///
/// @see core (dependence)
///
/// @defgroup gtc_type_aligned GLM_GTC_type_aligned
/// @ingroup gtc
///
/// @brief Aligned types.
/// <glm/gtc/type_aligned.hpp> 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 #pragma once

@ -1,6 +1,16 @@
#define GLM_FORCE_ALIGNED #define GLM_MESSAGES
#include <glm/glm.hpp>
#if GLM_HAS_ALIGNED_TYPE
#include <glm/gtc/type_aligned.hpp> #include <glm/gtc/type_aligned.hpp>
GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_lowp>::value, "aligned_lowp is not aligned");
GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_mediump>::value, "aligned_mediump is not aligned");
GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_highp>::value, "aligned_highp is not aligned");
GLM_STATIC_ASSERT(!glm::detail::is_aligned<glm::packed_highp>::value, "packed_highp is aligned");
GLM_STATIC_ASSERT(!glm::detail::is_aligned<glm::packed_mediump>::value, "packed_mediump is aligned");
GLM_STATIC_ASSERT(!glm::detail::is_aligned<glm::packed_lowp>::value, "packed_lowp is aligned");
struct my_vec4_packed struct my_vec4_packed
{ {
glm::uint32 a; glm::uint32 a;
@ -27,7 +37,6 @@ struct my_dvec4_aligned
glm::uint64 a; glm::uint64 a;
glm::aligned_dvec4 b; glm::aligned_dvec4 b;
}; };
//FIXME
//GLM_STATIC_ASSERT(sizeof(my_dvec4_aligned) == sizeof(glm::aligned_dvec4) * 2, "glm::dvec4 aligned is not correct"); //GLM_STATIC_ASSERT(sizeof(my_dvec4_aligned) == sizeof(glm::aligned_dvec4) * 2, "glm::dvec4 aligned is not correct");
struct my_ivec4_packed struct my_ivec4_packed
@ -81,7 +90,6 @@ int test_copy()
return Error; return Error;
} }
int main() int main()
{ {
int Error = 0; int Error = 0;
@ -99,3 +107,12 @@ int main()
return Error; return Error;
} }
#else
int main()
{
return 0;
}
#endif//GLM_HAS_ALIGNED_TYPE

@ -17,9 +17,11 @@ namespace
case glm::highp: os << "uhi"; break; case glm::highp: os << "uhi"; break;
case glm::mediump: os << "umd"; break; case glm::mediump: os << "umd"; break;
case glm::lowp: os << "ulo"; break; case glm::lowp: os << "ulo"; break;
case glm::aligned_highp: os << "ahi"; break; # if GLM_HAS_ALIGNED_TYPE
case glm::aligned_mediump: os << "amd"; break; case glm::aligned_highp: os << "ahi"; break;
case glm::aligned_lowp: os << "alo"; break; case glm::aligned_mediump: os << "amd"; break;
case glm::aligned_lowp: os << "alo"; break;
# endif
} }
} }

Loading…
Cancel
Save