Added C++17 detection, added VC language version detection, clean up alignment type, clean up swizzle operator detection

This commit is contained in:
Groove 2018-07-11 02:53:22 +02:00
parent bd2c7070d7
commit 16106b2e3e
21 changed files with 246 additions and 387 deletions

View File

@ -125,142 +125,94 @@
#define GLM_LANG_CXX03_FLAG (1 << 2)
#define GLM_LANG_CXX0X_FLAG (1 << 3)
#define GLM_LANG_CXX11_FLAG (1 << 4)
#define GLM_LANG_CXX1Y_FLAG (1 << 5)
#define GLM_LANG_CXX14_FLAG (1 << 6)
#define GLM_LANG_CXX1Z_FLAG (1 << 7)
#define GLM_LANG_CXXMS_FLAG (1 << 8)
#define GLM_LANG_CXXGNU_FLAG (1 << 9)
#define GLM_LANG_CXX14_FLAG (1 << 5)
#define GLM_LANG_CXX17_FLAG (1 << 6)
#define GLM_LANG_CXXMS_FLAG (1 << 7)
#define GLM_LANG_CXXGNU_FLAG (1 << 8)
#define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG
#define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
#define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
#define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
#define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
#define GLM_LANG_CXX14 (GLM_LANG_CXX1Y | GLM_LANG_CXX14_FLAG)
#define GLM_LANG_CXX1Z (GLM_LANG_CXX14 | GLM_LANG_CXX1Z_FLAG)
#define GLM_LANG_CXX14 (GLM_LANG_CXX11 | GLM_LANG_CXX14_FLAG)
#define GLM_LANG_CXX17 (GLM_LANG_CXX14 | GLM_LANG_CXX17_FLAG)
#define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
#define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
#if defined(GLM_FORCE_CXX14)
# if((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER <= GLM_COMPILER_GCC50)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER <= GLM_COMPILER_CLANG34))
# pragma message("GLM: Using GLM_FORCE_CXX14 with a compiler that doesn't fully support C++14")
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma message("GLM: Using GLM_FORCE_CXX14 but there is no known version of Visual C++ compiler that fully supports C++14")
# elif GLM_COMPILER & GLM_COMPILER_INTEL
# pragma message("GLM: Using GLM_FORCE_CXX14 but there is no known version of ICC compiler that fully supports C++14")
#ifdef _MSC_EXTENSIONS
# define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
#else
# define GLM_MSC_EXT 0
#endif
#ifdef _MSVC_LANG
# if _MSVC_LANG == 201703
# define GLM_FORCE_CXX17
# elif _MSVC_LANG == 201402
# define GLM_FORCE_CXX14
# endif
# define GLM_LANG GLM_LANG_CXX14
#endif
#if defined(GLM_FORCE_CXX17)
# if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_FORCE_CXX17_DISPLAYED)
# define GLM_MESSAGE_FORCE_CXX17_DISPLAYED
# if (__cplusplus >= 201703L) || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15_7)) || ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC80)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG50))
# pragma message("GLM: Force the use of C++17 only")
# else
# pragma message("GLM: Force the use of C++17 on a compiler that doesn't have full C++17 support")
# endif
# endif//GLM_MESSAGES
# define GLM_LANG (GLM_LANG_CXX17 | GLM_MSC_EXT)
# define GLM_LANG_STL11_FORCED
#elif defined(GLM_FORCE_CXX14)
# if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_FORCE_CXX14_DISPLAYED)
# define GLM_MESSAGE_FORCE_CXX14_DISPLAYED
# if (__cplusplus >= 201402L) || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC50)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG34))
# pragma message("GLM: Force the use of C++14 only")
# else
# pragma message("GLM: Force the use of C++14 on a compiler that doesn't have full C++14 support")
# endif
# endif//GLM_MESSAGES
# define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT)
# define GLM_LANG_STL11_FORCED
#elif defined(GLM_FORCE_CXX11)
# if((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER <= GLM_COMPILER_GCC48)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER <= GLM_COMPILER_CLANG33))
# pragma message("GLM: Using GLM_FORCE_CXX11 with a compiler that doesn't fully support C++11")
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma message("GLM: Using GLM_FORCE_CXX11 but there is no known version of Visual C++ compiler that fully supports C++11")
# elif GLM_COMPILER & GLM_COMPILER_INTEL
# pragma message("GLM: Using GLM_FORCE_CXX11 but there is no known version of ICC compiler that fully supports C++11")
# if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_FORCE_CXX11_DISPLAYED)
# define GLM_MESSAGE_FORCE_CXX11_DISPLAYED
# if (__cplusplus >= 201103L) || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG33))
# pragma message("GLM: Force the use of C++11 only")
# else
# pragma message("GLM: Force the use of C++11 on a compiler that doesn't have full C++11 support")
# endif
# define GLM_LANG GLM_LANG_CXX11
# endif//GLM_MESSAGES
# define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT)
# define GLM_LANG_STL11_FORCED
#elif defined(GLM_FORCE_CXX03)
# define GLM_LANG GLM_LANG_CXX03
#elif defined(GLM_FORCE_CXX98)
# define GLM_LANG GLM_LANG_CXX98
#else
# if GLM_COMPILER & GLM_COMPILER_CLANG
# if __cplusplus >= 201402L // GLM_COMPILER_CLANG34 + -std=c++14
# define GLM_LANG GLM_LANG_CXX14
# elif __has_feature(cxx_decltype_auto) && __has_feature(cxx_aggregate_nsdmi) // GLM_COMPILER_CLANG33 + -std=c++1y
# define GLM_LANG GLM_LANG_CXX1Y
# elif __cplusplus >= 201103L // GLM_COMPILER_CLANG33 + -std=c++11
# define GLM_LANG GLM_LANG_CXX11
# elif __has_feature(cxx_static_assert) // GLM_COMPILER_CLANG29 + -std=c++11
# define GLM_LANG GLM_LANG_CXX0X
# elif __cplusplus >= 199711L
# define GLM_LANG GLM_LANG_CXX98
# else
# define GLM_LANG GLM_LANG_CXX
# endif
# elif GLM_COMPILER & GLM_COMPILER_GCC
# if __cplusplus >= 201402L
# define GLM_LANG GLM_LANG_CXX14
# elif __cplusplus >= 201103L
# define GLM_LANG GLM_LANG_CXX11
# elif defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GLM_LANG GLM_LANG_CXX0X
# else
# define GLM_LANG GLM_LANG_CXX98
# endif
# elif GLM_COMPILER & GLM_COMPILER_VC
# ifdef _MSC_EXTENSIONS
# if __cplusplus >= 201402L
# define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
# elif __cplusplus >= 201103L
# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
# else
# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
# endif
# else
# if __cplusplus >= 201402L
# define GLM_LANG GLM_LANG_CXX14
# elif __cplusplus >= 201103L
# define GLM_LANG GLM_LANG_CXX11
# else
# define GLM_LANG GLM_LANG_CXX0X
# endif
# endif
# elif GLM_COMPILER & GLM_COMPILER_INTEL
# ifdef _MSC_EXTENSIONS
# define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
# else
# define GLM_MSC_EXT 0
# endif
# if __cplusplus >= 201402L
# if __cplusplus >= 201703L
# define GLM_LANG (GLM_LANG_CXX17 | GLM_MSC_EXT)
# elif __cplusplus >= 201402L
# define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT)
# elif __cplusplus >= 201103L
# define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT)
# elif __INTEL_CXX11_MODE__
# elif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
# elif __cplusplus >= 199711L
# define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
# else
# define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT)
# endif
# elif GLM_COMPILER & GLM_COMPILER_CUDA
# ifdef _MSC_EXTENSIONS
# define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
# else
# define GLM_MSC_EXT 0
# endif
# if GLM_COMPILER >= GLM_COMPILER_CUDA75
# define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
# else
# define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
# endif
# else // Unknown compiler
# if __cplusplus >= 201402L
# define GLM_LANG GLM_LANG_CXX14
# elif __cplusplus >= 201103L
# define GLM_LANG GLM_LANG_CXX11
# elif __cplusplus >= 199711L
# define GLM_LANG GLM_LANG_CXX98
# else
# define GLM_LANG GLM_LANG_CXX // Good luck with that!
# endif
# ifndef GLM_FORCE_PURE
# define GLM_FORCE_PURE
# endif
# endif
#endif
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_LANG_DISPLAYED)
# define GLM_MESSAGE_LANG_DISPLAYED
# if GLM_LANG & GLM_LANG_CXX1Z_FLAG
# pragma message("GLM: C++1z")
# if GLM_LANG & GLM_LANG_CXX17_FLAG
# pragma message("GLM: C++17")
# elif GLM_LANG & GLM_LANG_CXX14_FLAG
# pragma message("GLM: C++14")
# elif GLM_LANG & GLM_LANG_CXX1Y_FLAG
# pragma message("GLM: C++1y")
# elif GLM_LANG & GLM_LANG_CXX11_FLAG
# pragma message("GLM: C++11")
# elif GLM_LANG & GLM_LANG_CXX0X_FLAG
@ -340,7 +292,7 @@
// N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
#if GLM_COMPILER & GLM_COMPILER_CLANG
# define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
#elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG)
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_UNRESTRICTED_UNIONS 1
#else
# define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
@ -608,7 +560,7 @@
#define GLM_SWIZZLE_ENABLED 1
#define GLM_SWIZZLE_DISABLE 0
#if defined(GLM_FORCE_SWIZZLE)
#if defined(GLM_FORCE_SWIZZLE) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)
# define GLM_SWIZZLE GLM_SWIZZLE_ENABLED
#else
# define GLM_SWIZZLE GLM_SWIZZLE_DISABLE
@ -619,7 +571,7 @@
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
# pragma message("GLM: Swizzling operators enabled")
# else
# pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
# pragma message("GLM: Swizzling operators disabled, #define GLM_FORCE_SWIZZLE to enable swizzle operators")
# endif
#endif//GLM_MESSAGES

View File

@ -10,92 +10,101 @@
namespace glm{
namespace detail
{
template<typename T, std::size_t size, bool aligned>
template<length_t L, typename T, qualifier Q>
struct storage_alignment
{};
template<length_t L, typename T>
struct alignas(L * sizeof(T)) storage_alignment<L, T, aligned_highp>
{};
template<length_t L, typename T>
struct alignas(L * sizeof(T)) storage_alignment<L, T, aligned_mediump>
{};
template<length_t L, typename T>
struct alignas(L * sizeof(T)) storage_alignment<L, T, aligned_lowp>
{};
template<length_t L, typename T, bool is_aligned>
struct storage
{
typedef struct type {
uint8 data[size];
T data[L];
} type;
};
#define GLM_ALIGNED_STORAGE_TYPE_STRUCT(x) \
template<typename T> \
struct storage<T, x, true> { \
GLM_ALIGNED_STRUCT(x) type { \
uint8 data[x]; \
}; \
template<length_t L, typename T>
struct storage<L, T, true>
{
typedef struct alignas(L * sizeof(T)) type {
T data[L];
} type;
};
GLM_ALIGNED_STORAGE_TYPE_STRUCT(1)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(2)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(4)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(8)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(16)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(32)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(64)
template<typename T>
struct storage<3, T, true>
{
typedef struct alignas(4 * sizeof(T)) type {
T data[4];
} type;
};
# if GLM_ARCH & GLM_ARCH_SSE2_BIT
template<>
struct storage<float, 16, true>
struct storage<4, float, true>
{
typedef glm_vec4 type;
typedef glm_f32vec4 type;
};
template<>
struct storage<int, 16, true>
struct storage<4, int32, true>
{
typedef glm_ivec4 type;
typedef glm_i32vec4 type;
};
template<>
struct storage<unsigned int, 16, true>
struct storage<4, uint32, true>
{
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;
typedef glm_u32vec4 type;
};
template<>
struct storage<int, 16, true>
struct storage<2, double, true>
{
typedef glm_128 type;
typedef glm_f64vec2 type;
};
template<>
struct storage<unsigned int, 16, true>
struct storage<2, int64, true>
{
typedef glm_128 type;
typedef glm_i64vec2 type;
};
template<>
struct storage<2, uint64, true>
{
typedef glm_u64vec2 type;
};
*/
# endif
# if (GLM_ARCH & GLM_ARCH_AVX_BIT)
template<>
struct storage<double, 32, true>
struct storage<4, double, true>
{
typedef glm_dvec4 type;
typedef glm_f64vec4 type;
};
# endif
# if (GLM_ARCH & GLM_ARCH_AVX2_BIT)
template<>
struct storage<int64, 32, true>
struct storage<4, int64, true>
{
typedef glm_i64vec4 type;
};
template<>
struct storage<uint64, 32, true>
struct storage<4, uint64, true>
{
typedef glm_u64vec4 type;
};

View File

@ -5,7 +5,7 @@
#include "type_vec.hpp"
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
# if GLM_HAS_UNRESTRICTED_UNIONS
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
@ -29,23 +29,15 @@ namespace glm
# if GLM_HAS_ONLY_XYZW
T x, y;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# endif
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
# elif GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
struct{ T x, y; };
struct{ T r, g; };
struct{ T s, t; };
typename detail::storage<2, T, detail::is_aligned<Q>::value>::type data;
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)
GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)
@ -57,22 +49,14 @@ namespace glm
GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)
GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)
# endif//GLM_SWIZZLE
};
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# endif
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# endif
# else
union {T x, r, s;};
union {T y, g, t;};
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P)
# endif//GLM_SWIZZLE
//# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
// GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)
//# endif//GLM_SWIZZLE
# endif
// -- Component accesses --

View File

@ -5,7 +5,7 @@
#include "type_vec.hpp"
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
# if GLM_HAS_UNRESTRICTED_UNIONS
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
@ -29,23 +29,15 @@ namespace glm
# if GLM_HAS_ONLY_XYZW
T x, y, z;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# endif
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
# elif GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
struct{ T x, y, z; };
struct{ T r, g, b; };
struct{ T s, t, p; };
typename detail::storage<3, T, detail::is_aligned<Q>::value>::type data;
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)
GLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)
@ -58,21 +50,14 @@ namespace glm
GLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)
# endif//GLM_SWIZZLE
};
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# endif
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# endif
# else
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P)
# endif//GLM_SWIZZLE
//# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
// GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q)
//# endif//GLM_SWIZZLE
# endif//GLM_LANG
// -- Component accesses --

View File

@ -5,7 +5,7 @@
#include "type_vec.hpp"
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
# if GLM_HAS_UNRESTRICTED_UNIONS
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
@ -16,7 +16,7 @@
namespace glm
{
template<typename T, qualifier Q>
struct vec<4, T, Q>
struct vec<4, T, Q> : detail::storage_alignment<4, T, Q>
{
// -- Implementation detail --
@ -29,24 +29,14 @@ namespace glm
# if GLM_HAS_ONLY_XYZW
T x, y, z, w;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# endif
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
# elif GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
struct { T x, y, z, w; };
struct { T r, g, b, a; };
struct { T s, t, p, q; };
typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<Q>::value>::type data;
typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data;
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE4_2_MEMBERS(T, Q, x, y, z, w)
@ -60,22 +50,15 @@ namespace glm
GLM_SWIZZLE4_4_MEMBERS(T, Q, s, t, p, q)
# endif//GLM_SWIZZLE
};
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# endif
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# endif
# else
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
union { T w, a, q; };
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P)
# endif//GLM_SWIZZLE
//# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
// GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, Q)
//# endif//GLM_SWIZZLE
# endif
// -- Component accesses --

View File

@ -15,7 +15,7 @@
#include "../fwd.hpp"
#include "../detail/type_vec.hpp"
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
# if GLM_HAS_UNRESTRICTED_UNIONS
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
# include "../detail/_swizzle.hpp"
# else
# include "../detail/_swizzle_func.hpp"
@ -46,22 +46,14 @@ namespace glm
# if GLM_HAS_ONLY_XYZW
T x;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# endif
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
# elif GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
T x;
T r;
T s;
typename detail::storage<1, T, detail::is_aligned<Q>::value>::type data;
/*
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, x)
@ -75,18 +67,11 @@ namespace glm
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, s)
# endif//GLM_SWIZZLE*/
};
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# endif
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# endif
# else
union {T x, r, s;};
/*
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, P, tvec2, tvec2, tvec3, tvec4)
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q, tvec2, tvec2, tvec3, tvec4)
# endif//GLM_SWIZZLE*/
# endif

View File

@ -39,29 +39,11 @@ namespace glm
// -- Data --
# if GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic"
# endif
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
struct { T x, y, z, w;};
typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<Q>::value>::type data;
};
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# endif
# if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic pop
# endif
# else
T x, y, z, w;
# endif

View File

@ -7,52 +7,52 @@
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_add(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_add(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_add_ps(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_add(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_add(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_add_ss(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sub(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sub(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_sub_ps(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_sub(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sub(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_sub_ss(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_mul(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_mul(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_mul_ps(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_mul(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_mul(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_mul_ss(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_div(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_div(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_div_ps(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_div(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_div(glm_f32vec4 a, glm_f32vec4 b)
{
return _mm_div_ss(a, b);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_div_lowp(glm_vec4 a, glm_vec4 b)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_div_lowp(glm_f32vec4 a, glm_f32vec4 b)
{
return glm_vec4_mul(a, _mm_rcp_ps(b));
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_swizzle_xyzw(glm_vec4 a)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_swizzle_xyzw(glm_f32vec4 a)
{
# if GLM_ARCH & GLM_ARCH_AVX2_BIT
return _mm_permute_ps(a, _MM_SHUFFLE(3, 2, 1, 0));
@ -61,7 +61,7 @@ GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_swizzle_xyzw(glm_vec4 a)
# endif
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_fma(glm_vec4 a, glm_vec4 b, glm_vec4 c)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_fma(glm_f32vec4 a, glm_f32vec4 b, glm_f32vec4 c)
{
# if (GLM_ARCH & GLM_ARCH_AVX2_BIT) && !(GLM_COMPILER & GLM_COMPILER_CLANG)
return _mm_fmadd_ss(a, b, c);
@ -70,7 +70,7 @@ GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_fma(glm_vec4 a, glm_vec4 b, glm_vec4 c)
# endif
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_fma(glm_vec4 a, glm_vec4 b, glm_vec4 c)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_fma(glm_f32vec4 a, glm_f32vec4 b, glm_f32vec4 c)
{
# if (GLM_ARCH & GLM_ARCH_AVX2_BIT) && !(GLM_COMPILER & GLM_COMPILER_CLANG)
return _mm_fmadd_ps(a, b, c);
@ -79,7 +79,7 @@ GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_fma(glm_vec4 a, glm_vec4 b, glm_vec4 c)
# endif
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_abs(glm_vec4 x)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_abs(glm_f32vec4 x)
{
return _mm_and_ps(x, _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF)));
}

View File

@ -7,12 +7,12 @@
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_sqrt_lowp(glm_vec4 x)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x)
{
return _mm_mul_ss(_mm_rsqrt_ss(x), x);
}
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sqrt_lowp(glm_vec4 x)
GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x)
{
return _mm_mul_ps(_mm_rsqrt_ps(x), x);
}

View File

@ -385,13 +385,22 @@
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
typedef __m128 glm_vec4;
typedef __m128i glm_ivec4;
typedef __m128i glm_uvec4;
typedef __m128 glm_f32vec4;
typedef __m128i glm_i32vec4;
typedef __m128i glm_u32vec4;
typedef __m128d glm_f64vec2;
typedef __m128i glm_i64vec2;
typedef __m128i glm_u64vec2;
typedef glm_f32vec4 glm_vec4;
typedef glm_i32vec4 glm_ivec4;
typedef glm_u32vec4 glm_uvec4;
typedef glm_f64vec2 glm_dvec2;
#endif
#if GLM_ARCH & GLM_ARCH_AVX_BIT
typedef __m256d glm_dvec4;
typedef __m256d glm_f64vec4;
typedef glm_f64vec4 glm_dvec4;
#endif
#if GLM_ARCH & GLM_ARCH_AVX2_BIT

View File

@ -54,6 +54,8 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
### [GLM 0.9.9.1](https://github.com/g-truc/glm/commits/master) - 2018-0X-XX
#### Features:
- Added bitfieldDeinterleave to GTC_bitfield
- Added C++17 detection
- Added Visual C++ language standard version detection
#### Improvements:
- Added missing vec1 based constructors
@ -63,6 +65,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
#### Fixes:
- Fixed build problems due to printf and std::clock_t #778
- Fixed int mod
- Anonymous unions require C++ language extensions
### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/tag/0.9.9.0) - 2018-05-22
#### Features:

View File

@ -50,7 +50,7 @@ int test_vec4_ctor()
}
#endif
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
glm::vec4 B = A.xyzw;
@ -79,7 +79,7 @@ int test_vec4_ctor()
Error += glm::all(glm::equal(A, L)) ? 0 : 1;
Error += glm::all(glm::equal(A, M)) ? 0 : 1;
}
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec4 A(1);

View File

@ -1291,8 +1291,10 @@ namespace ldexp_
static int test_constexpr()
{
#if GLM_HAS_CONSTEXPR_CXX11
static_assert(glm::abs(1.0f) > 0.0f, "GLM: Failed constexpr");
static_assert(glm::abs(glm::vec3(1.0f)) != glm::vec3(0.0f), "GLM: Failed constexpr");
#endif // GLM_HAS_CONSTEXPR_CXX11
return 0;
}

View File

@ -4,16 +4,18 @@
#if !GLM_HAS_ONLY_XYZW
int test_ivec2_swizzle()
static int test_ivec2_swizzle()
{
int Error = 0;
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
glm::ivec2 A(1, 2);
glm::ivec2 B = A.yx();
glm::ivec2 C = B.yx();
Error += A != B ? 0 : 1;
Error += A == C ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
return Error;
}
@ -22,12 +24,14 @@ int test_ivec3_swizzle()
{
int Error = 0;
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
glm::ivec3 A(1, 2, 3);
glm::ivec3 B = A.zyx();
glm::ivec3 C = B.zyx();
Error += A != B ? 0 : 1;
Error += A == C ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
return Error;
}
@ -36,12 +40,14 @@ int test_ivec4_swizzle()
{
int Error = 0;
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
glm::ivec4 A(1, 2, 3, 4);
glm::ivec4 B = A.wzyx();
glm::ivec4 C = B.wzyx();
Error += A != B ? 0 : 1;
Error += A == C ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
return Error;
}
@ -50,6 +56,7 @@ int test_vec4_swizzle()
{
int Error = 0;
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
glm::vec4 A(1, 2, 3, 4);
glm::vec4 B = A.wzyx();
glm::vec4 C = B.wzyx();
@ -59,6 +66,7 @@ int test_vec4_swizzle()
float f = glm::dot(C.wzyx(), C.xyzw());
Error += glm::abs(f - 20.f) < 0.01f ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
return Error;
}

View File

@ -1,57 +1,38 @@
#include <glm/glm.hpp>
#if GLM_HAS_ALIGNOF
# include <type_traits>
#endif
int test_aligned()
{
int Error = 0;
size_t size1_aligned = sizeof(glm::detail::storage<int, 1, true>::type);
Error += size1_aligned == 1 ? 0 : 1;
size_t size2_aligned = sizeof(glm::detail::storage<int, 2, true>::type);
Error += size2_aligned == 2 ? 0 : 1;
size_t size4_aligned = sizeof(glm::detail::storage<int, 4, true>::type);
Error += size4_aligned == 4 ? 0 : 1;
size_t size8_aligned = sizeof(glm::detail::storage<int, 8, true>::type);
Error += size8_aligned == 8 ? 0 : 1;
size_t size16_aligned = sizeof(glm::detail::storage<int, 16, true>::type);
Error += size16_aligned == 16 ? 0 : 1;
size_t size32_aligned = sizeof(glm::detail::storage<int, 32, true>::type);
Error += size32_aligned == 32 ? 0 : 1;
size_t size64_aligned = sizeof(glm::detail::storage<int, 64, true>::type);
Error += size64_aligned == 64 ? 0 : 1;
GLM_STATIC_ASSERT(sizeof(glm::vec4) == 4 * sizeof(float), "Invalid sizeof");
size_t size1_aligned = sizeof(glm::detail::storage<1, int, true>::type);
Error += size1_aligned == sizeof(int) * 1 ? 0 : 1;
size_t size2_aligned = sizeof(glm::detail::storage<2, int, true>::type);
Error += size2_aligned == sizeof(int) * 2 ? 0 : 1;
size_t size4_aligned = sizeof(glm::detail::storage<4, int, true>::type);
Error += size4_aligned == sizeof(int) * 4 ? 0 : 1;
# if GLM_HAS_ALIGNOF
size_t align1_aligned = alignof(glm::detail::storage<int, 1, true>::type);
Error += align1_aligned == 1 ? 0 : 1;
size_t align2_aligned = alignof(glm::detail::storage<int, 2, true>::type);
Error += align2_aligned == 2 ? 0 : 1;
size_t align4_aligned = alignof(glm::detail::storage<int, 4, true>::type);
Error += align4_aligned == 4 ? 0 : 1;
size_t align8_aligned = alignof(glm::detail::storage<int, 8, true>::type);
Error += align8_aligned == 8 ? 0 : 1;
size_t align16_aligned = alignof(glm::detail::storage<int, 16, true>::type);
Error += align16_aligned == 16 ? 0 : 1;
size_t align32_aligned = alignof(glm::detail::storage<int, 32, true>::type);
Error += align32_aligned == 32 ? 0 : 1;
size_t align64_aligned = alignof(glm::detail::storage<int, 64, true>::type);
Error += align64_aligned == 64 ? 0 : 1;
size_t align1_aligned = alignof(glm::detail::storage<1, int, true>::type);
Error += align1_aligned == 4 ? 0 : 1;
size_t align2_aligned = alignof(glm::detail::storage<2, int, true>::type);
Error += align2_aligned == 8 ? 0 : 1;
size_t align4_aligned = alignof(glm::detail::storage<4, int, true>::type);
Error += align4_aligned == 16 ? 0 : 1;
# elif GLM_COMPILER & GLM_COMPILER_GCC
size_t align1_aligned = __alignof__(glm::detail::storage<int, 1, true>::type);
Error += align1_aligned == 1 ? 0 : 1;
size_t align2_aligned = __alignof__(glm::detail::storage<int, 2, true>::type);
Error += align2_aligned == 2 ? 0 : 1;
size_t align4_aligned = __alignof__(glm::detail::storage<int, 4, true>::type);
Error += align4_aligned == 4 ? 0 : 1;
size_t align8_aligned = __alignof__(glm::detail::storage<int, 8, true>::type);
Error += align8_aligned == 8 ? 0 : 1;
size_t align16_aligned = __alignof__(glm::detail::storage<int, 16, true>::type);
Error += align16_aligned == 16 ? 0 : 1;
size_t align32_aligned = __alignof__(glm::detail::storage<int, 32, true>::type);
Error += align32_aligned == 32 ? 0 : 1;
size_t align64_aligned = __alignof__(glm::detail::storage<int, 64, true>::type);
Error += align64_aligned == 64 ? 0 : 1;
size_t align1_aligned = __alignof__(glm::detail::storage<1, int, true>::type);
Error += align1_aligned == 4 ? 0 : 1;
size_t align2_aligned = __alignof__(glm::detail::storage<2, int, true>::type);
Error += align2_aligned == 8 ? 0 : 1;
size_t align8_aligned = __alignof__(glm::detail::storage<4, int, true>::type);
Error += align8_aligned == 16 ? 0 : 1;
# endif //GLM_HAS_ALIGNOF
@ -62,61 +43,33 @@ int test_unaligned()
{
int Error = 0;
size_t size1_unaligned = sizeof(glm::detail::storage<int, 1, false>::type);
Error += size1_unaligned == 1 ? 0 : 1;
size_t size2_unaligned = sizeof(glm::detail::storage<int, 2, false>::type);
Error += size2_unaligned == 2 ? 0 : 1;
size_t size4_unaligned = sizeof(glm::detail::storage<int, 4, false>::type);
Error += size4_unaligned == 4 ? 0 : 1;
size_t size8_unaligned = sizeof(glm::detail::storage<int, 8, false>::type);
Error += size8_unaligned == 8 ? 0 : 1;
size_t size16_unaligned = sizeof(glm::detail::storage<int, 16, false>::type);
Error += size16_unaligned == 16 ? 0 : 1;
size_t size32_unaligned = sizeof(glm::detail::storage<int, 32, false>::type);
Error += size32_unaligned == 32 ? 0 : 1;
size_t size64_unaligned = sizeof(glm::detail::storage<int, 64, false>::type);
Error += size64_unaligned == 64 ? 0 : 1;
# if GLM_HAS_ALIGNOF
size_t align1_unaligned = alignof(glm::detail::storage<int, 1, false>::type);
Error += align1_unaligned == 1 ? 0 : 1;
size_t align2_unaligned = alignof(glm::detail::storage<int, 2, false>::type);
Error += align2_unaligned == 1 ? 0 : 1;
size_t align4_unaligned = alignof(glm::detail::storage<int, 4, false>::type);
Error += align4_unaligned == 1 ? 0 : 1;
size_t align8_unaligned = alignof(glm::detail::storage<int, 8, false>::type);
Error += align8_unaligned == 1 ? 0 : 1;
size_t align16_unaligned = alignof(glm::detail::storage<int, 16, false>::type);
Error += align16_unaligned == 1 ? 0 : 1;
size_t align32_unaligned = alignof(glm::detail::storage<int, 32, false>::type);
Error += align32_unaligned == 1 ? 0 : 1;
size_t align64_unaligned = alignof(glm::detail::storage<int, 64, false>::type);
Error += align64_unaligned == 1 ? 0 : 1;
size_t align1_unaligned = alignof(glm::detail::storage<1, int, false>::type);
Error += align1_unaligned == sizeof(int) ? 0 : 1;
size_t align2_unaligned = alignof(glm::detail::storage<2, int, false>::type);
Error += align2_unaligned == sizeof(int) ? 0 : 1;
size_t align3_unaligned = alignof(glm::detail::storage<3, int, false>::type);
Error += align3_unaligned == sizeof(int) ? 0 : 1;
size_t align4_unaligned = alignof(glm::detail::storage<4, int, false>::type);
Error += align4_unaligned == sizeof(int) ? 0 : 1;
# elif GLM_COMPILER & GLM_COMPILER_GCC
size_t align1_unaligned = __alignof__(glm::detail::storage<int, 1, false>::type);
Error += align1_unaligned == 1 ? 0 : 1;
size_t align2_unaligned = __alignof__(glm::detail::storage<int, 2, false>::type);
Error += align2_unaligned == 1 ? 0 : 1;
size_t align4_unaligned = __alignof__(glm::detail::storage<int, 4, false>::type);
Error += align4_unaligned == 1 ? 0 : 1;
size_t align8_unaligned = __alignof__(glm::detail::storage<int, 8, false>::type);
Error += align8_unaligned == 1 ? 0 : 1;
size_t align16_unaligned = __alignof__(glm::detail::storage<int, 16, false>::type);
Error += align16_unaligned == 1 ? 0 : 1;
size_t align32_unaligned = __alignof__(glm::detail::storage<int, 32, false>::type);
Error += align32_unaligned == 1 ? 0 : 1;
size_t align64_unaligned = __alignof__(glm::detail::storage<int, 64, false>::type);
Error += align64_unaligned == 1 ? 0 : 1;
size_t align1_unaligned = __alignof__(glm::detail::storage<1, int, false>::type);
Error += align1_unaligned == sizeof(int) ? 0 : 1;
size_t align2_unaligned = __alignof__(glm::detail::storage<2, int, false>::type);
Error += align2_unaligned == sizeof(int) ? 0 : 1;
size_t align4_unaligned = __alignof__(glm::detail::storage<3, int, false>::type);
Error += align4_unaligned == sizeof(int) ? 0 : 1;
size_t align8_unaligned = __alignof__(glm::detail::storage<4, int, false>::type);
Error += align8_unaligned == sizeof(int) ? 0 : 1;
# endif //GLM_HAS_ALIGNOF
return Error;
}
int main()
{
int Error = 0;

View File

@ -180,7 +180,7 @@ int test_inverse()
int test_ctr()
{
int Error(0);
int Error = 0;
#if GLM_HAS_TRIVIAL_QUERIES
//Error += std::is_trivially_default_constructible<glm::mat4>::value ? 0 : 1;
@ -190,7 +190,7 @@ int test_ctr()
//Error += std::has_trivial_copy_constructor<glm::mat4>::value ? 0 : 1;
#endif
#if(GLM_HAS_INITIALIZER_LISTS)
#if GLM_HAS_INITIALIZER_LISTS
glm::mat4 m0(
glm::vec4(0, 1, 2, 3),
glm::vec4(4, 5, 6, 7),

View File

@ -69,7 +69,7 @@ int test_vec1_ctor()
}
#endif
*/
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy;
@ -80,7 +80,7 @@ int test_vec1_ctor()
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
}
#endif//GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec2 A = glm::vec2(2.0f);

View File

@ -236,7 +236,7 @@ static int test_ctor()
}
#endif
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy;
@ -247,7 +247,7 @@ static int test_ctor()
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
}
#endif//GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec2 A = glm::vec2(2.0f);

View File

@ -45,7 +45,7 @@ int test_vec3_ctor()
}
#endif
#if(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE))
#if(GLM_LANG & GLM_LANG_CXXMS_FLAG && defined(GLM_FORCE_SWIZZLE))
{
glm::vec3 A = glm::vec3(1.0f, 2.0f, 3.0f);
glm::vec3 B = A.xyz;
@ -64,7 +64,7 @@ int test_vec3_ctor()
Error += glm::all(glm::equal(A, G)) ? 0 : 1;
Error += glm::all(glm::equal(A, H)) ? 0 : 1;
}
#endif//(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE))
#endif//(GLM_LANG & GLM_LANG_CXXMS_FLAG && defined(GLM_FORCE_SWIZZLE))
{
glm::vec3 A(1);
@ -469,6 +469,8 @@ int test_vec3_swizzle_functions()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
// NOTE: template functions cannot pick up the implicit conversion from
// a swizzle to the unswizzled type, therefore the operator() must be
// used. E.g.:
@ -501,6 +503,8 @@ int test_vec3_swizzle_functions()
r = glm::dot(s.xyzw(), t.xyzw()); Error += (int(r) == 300) ? 0 : 1;
r = glm::dot(s.xyz(), t.xyz()); Error += (int(r) == 140) ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
return Error;
}

View File

@ -74,7 +74,7 @@ static int test_vec4_ctor()
}
#endif
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
glm::vec4 B = A.xyzw;
@ -103,7 +103,7 @@ static int test_vec4_ctor()
Error += glm::all(glm::equal(A, L)) ? 0 : 1;
Error += glm::all(glm::equal(A, M)) ? 0 : 1;
}
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
#endif// GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
{
glm::vec4 A(1);