Added C++17 detection, added VC language version detection, clean up alignment type, clean up swizzle operator detection
This commit is contained in:
@@ -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")
|
||||
# endif
|
||||
# define GLM_LANG GLM_LANG_CXX11
|
||||
# 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
|
||||
# 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
|
||||
# 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__
|
||||
# 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
|
||||
# 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 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
|
||||
#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
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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 --
|
||||
|
||||
@@ -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 --
|
||||
|
||||
@@ -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 --
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace glm
|
||||
typedef aligned_highp_vec3 aligned_vec3;
|
||||
|
||||
/// 4 components vector aligned in memory of single-precision floating-point numbers.
|
||||
typedef aligned_highp_vec4 aligned_vec4;
|
||||
typedef aligned_highp_vec4 aligned_vec4;
|
||||
|
||||
/// 1 component vector tightly packed in memory of single-precision floating-point numbers.
|
||||
typedef packed_highp_vec1 packed_vec1;
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -385,16 +385,25 @@
|
||||
#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
|
||||
typedef __m256i glm_i64vec4;
|
||||
typedef __m256i glm_u64vec4;
|
||||
typedef __m256i glm_i64vec4;
|
||||
typedef __m256i glm_u64vec4;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user