diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 619e7adc..436b7909 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -43,6 +43,8 @@ // GCC defines #define GLM_COMPILER_GCC 0x02000000 +#define GLM_COMPILER_GCC_LLVM 0x02000000 +#define GLM_COMPILER_GCC_CLANG 0x02000000 #define GLM_COMPILER_GCC30 0x02000010 #define GLM_COMPILER_GCC31 0x02000020 #define GLM_COMPILER_GCC32 0x02000030 @@ -145,22 +147,19 @@ # define GLM_COMPILER GLM_COMPILER_VC # endif//_MSC_VER -#elif defined(__clang__) -# if (__clang_major__ == 2) && (__clang_minor__ == 6) -# define GLM_COMPILER GLM_COMPILER_CLANG26 -# elif (__clang_major__ == 2) && (__clang_minor__ == 7) -# define GLM_COMPILER GLM_COMPILER_CLANG27 -# elif (__clang_major__ == 2) && (__clang_minor__ == 8) -# define GLM_COMPILER GLM_COMPILER_CLANG28 -# elif (__clang_major__ == 2) && (__clang_minor__ == 9) -# define GLM_COMPILER GLM_COMPILER_CLANG29 -# endif - -#elif defined(__llvm__) -# define GLM_COMPILER GLM_COMPILER_LLVM_GCC - // G++ -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__llvm__) || defined(__clang__) +# if defined (__llvm__) +# pragma message("LLVM") +# define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_LLVM +# elif defined (__clang__) +# pragma message("CLANG") +# define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_CLANG +# else +# pragma message("GCC") +# define GLM_COMPILER_GCC_EXTRA 0 +# endif +# # if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2) # define GLM_COMPILER GLM_COMPILER_GCC32 # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3) @@ -170,29 +169,29 @@ # elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5) # define GLM_COMPILER GLM_COMPILER_GCC35 # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0) -# define GLM_COMPILER GLM_COMPILER_GCC40 +# define GLM_COMPILER (GLM_COMPILER_GCC40 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1) -# define GLM_COMPILER GLM_COMPILER_GCC41 +# define GLM_COMPILER (GLM_COMPILER_GCC41 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) -# define GLM_COMPILER GLM_COMPILER_GCC42 +# define GLM_COMPILER (GLM_COMPILER_GCC42 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) -# define GLM_COMPILER GLM_COMPILER_GCC43 +# define GLM_COMPILER (GLM_COMPILER_GCC43 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4) -# define GLM_COMPILER GLM_COMPILER_GCC44 +# define GLM_COMPILER (GLM_COMPILER_GCC44 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5) -# define GLM_COMPILER GLM_COMPILER_GCC45 +# define GLM_COMPILER (GLM_COMPILER_GCC45 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6) -# define GLM_COMPILER GLM_COMPILER_GCC46 +# define GLM_COMPILER (GLM_COMPILER_GCC46 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7) -# define GLM_COMPILER GLM_COMPILER_GCC47 +# define GLM_COMPILER (GLM_COMPILER_GCC47 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) -# define GLM_COMPILER GLM_COMPILER_GCC48 +# define GLM_COMPILER (GLM_COMPILER_GCC48 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9) -# define GLM_COMPILER GLM_COMPILER_GCC49 +# define GLM_COMPILER (GLM_COMPILER_GCC49 | GLM_COMPILER_GCC_EXTRA) # elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0) -# define GLM_COMPILER GLM_COMPILER_GCC50 +# define GLM_COMPILER (GLM_COMPILER_GCC50 | GLM_COMPILER_GCC_EXTRA) # else -# define GLM_COMPILER GLM_COMPILER_GCC +# define GLM_COMPILER (GLM_COMPILER_GCC | GLM_COMPILER_GCC_EXTRA) # endif // Borland C++ @@ -233,7 +232,13 @@ # elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC) # pragma message("GLM: LLVM GCC compiler detected") # elif(GLM_COMPILER & GLM_COMPILER_GCC) -# pragma message("GLM: GCC compiler detected") +# if(GLM_COMPILER & GLM_COMPILER_GCC_LLVM) +# pragma message("GLM: LLVM GCC compiler detected") +# elif(GLM_COMPILER & GLM_COMPILER_GCC_CLANG) +# pragma message("GLM: CLANG compiler detected") +# else +# pragma message("GLM: GCC compiler detected") +# endif # elif(GLM_COMPILER & GLM_COMPILER_BC) # pragma message("GLM: Borland compiler detected but not supported") # elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR) @@ -354,7 +359,6 @@ # define GLM_ARCH GLM_ARCH_PURE # endif #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) -# error "GCC" # if(defined(__AVX__)) # define GLM_ARCH GLM_ARCH_AVX # elif(defined(__SSE3__)) diff --git a/glm/gtc/swizzle.hpp b/glm/gtc/swizzle.hpp index b3441326..b2e46b89 100644 --- a/glm/gtc/swizzle.hpp +++ b/glm/gtc/swizzle.hpp @@ -75,7 +75,7 @@ namespace swizzle ///< GLM_GTC_swizzle extension template \ GLM_FUNC_QUALIFIER TYPE& swizzle(detail::tvec##SIZE & v) \ {return v[x];} - +/* static_swizzle1(detail::float16, 2) static_swizzle1(detail::float16, 3) static_swizzle1(detail::float16, 4) @@ -126,32 +126,34 @@ namespace swizzle ///< GLM_GTC_swizzle extension template \ GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \ {return TYPE(v[x], v[y], v[z], v[w]);} -/* -# define static_swizzle2_const(TYPE, SIZE) \ +*/ + +# define static_swizzle2_const(TYPE, SIZE) \ template \ GLM_FUNC_QUALIFIER detail::tvec2 swizzle(detail::tvec##SIZE const & v) \ {return detail::tvec2(v[x], v[y]);} -# define static_swizzle3_const(TYPE, SIZE) \ +# define static_swizzle3_const(TYPE, SIZE) \ template \ GLM_FUNC_QUALIFIER detail::tvec3 swizzle(detail::tvec##SIZE const & v) \ {return detail::tvec3(v[x], v[y], v[z]);} -# define static_swizzle4_const(TYPE, SIZE) \ +# define static_swizzle4_const(TYPE, SIZE) \ template \ GLM_FUNC_QUALIFIER detail::tvec4 swizzle(detail::tvec##SIZE const & v) \ {return detail::tvec4(v[x], v[y], v[z], v[w]);} -*/ - static_swizzle2_const(glm::f16vec2) - static_swizzle2_const(glm::f16vec3) - static_swizzle2_const(glm::f16vec4) - static_swizzle2_const(glm::f32vec2) - static_swizzle2_const(glm::f32vec3) - static_swizzle2_const(glm::f32vec4) - static_swizzle2_const(glm::f64vec2) - static_swizzle2_const(glm::f64vec3) - static_swizzle2_const(glm::f64vec4) + + static_swizzle2_const(glm::f16vec2, 2) + static_swizzle2_const(glm::f16vec3, 3) + static_swizzle2_const(glm::f16vec4, 4) + static_swizzle2_const(glm::f32vec2, 2) + static_swizzle2_const(glm::f32vec3, 3) + static_swizzle2_const(glm::f32vec4, 4) + static_swizzle2_const(glm::f64vec2, 2) + static_swizzle2_const(glm::f64vec3, 3) + static_swizzle2_const(glm::f64vec4, 4) +/* static_swizzle2_const(glm::i8vec2) static_swizzle2_const(glm::i8vec3) static_swizzle2_const(glm::i8vec4) @@ -339,7 +341,7 @@ namespace swizzle ///< GLM_GTC_swizzle extension static_swizzle4_ref(glm::u16vec4) static_swizzle4_ref(glm::u32vec4) static_swizzle4_ref(glm::u64vec4) - +*/ }//namespace swizzle }//namespace gtc }//namespace glm diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index b6fb0fd8..d7b1863a 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -314,6 +314,8 @@ namespace glm detail::fvec4SIMD const & x ) { + //return x < 0 ? -floor(-x) : floor(x); + __m128 Flr0 = detail::sse_flr_ps(_mm_sub_ps(_mm_setzero_ps(), x.Data)); __m128 Sub0 = _mm_sub_ps(Flr0, x.Data); __m128 Flr1 = detail::sse_flr_ps(x.Data); @@ -321,7 +323,7 @@ namespace glm __m128 Cmp0 = _mm_cmplt_ps(x.Data, glm::detail::zero); __m128 Cmp1 = _mm_cmpnlt_ps(x.Data, glm::detail::zero); - __m128 And0 = _mm_and_ps(Flr0, Cmp0); + __m128 And0 = _mm_and_ps(Sub0, Cmp0); __m128 And1 = _mm_and_ps(Flr1, Cmp1); return _mm_or_ps(And0, And1);