From dc979ddfaf02ee2ea73d838d6a171695e1b0007d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 20 Jan 2011 14:06:56 +0000 Subject: [PATCH] Updated architechture detection and checking --- glm/gtx/simd_mat4.hpp | 5 +++++ glm/gtx/simd_vec4.hpp | 5 +++++ glm/setup.hpp | 48 +++++++++++++++++++------------------------ 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 6611b540..442fbd41 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -16,6 +16,11 @@ // Dependency: #include "../glm.hpp" + +#if(!(GLM_ARCH & GLM_ARCH_SSE2)) +#error "GLM: GLM_GTX_simd_mat4 requires compiler support of SSE2 through intrinsics" +#endif + #include "../core/intrinsic_matrix.hpp" #include "../gtx/simd_vec4.hpp" diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index a83dd6b6..2c9de23b 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -16,6 +16,11 @@ // Dependency: #include "../glm.hpp" + +#if(!(GLM_ARCH & GLM_ARCH_SSE2)) +#error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics" +#endif + #include "../core/intrinsic_common.hpp" #include "../core/intrinsic_geometric.hpp" diff --git a/glm/setup.hpp b/glm/setup.hpp index 1e2f9401..6d5a1c66 100644 --- a/glm/setup.hpp +++ b/glm/setup.hpp @@ -254,54 +254,48 @@ ///////////////// // Platform -#define GLM_SUPPORT_PURE 0 -#define GLM_SUPPORT_SSE2 1 -#define GLM_SUPPORT_SSE3 2 -#define GLM_SUPPORT_AVX 3 +#define GLM_ARCH_PURE 0x0000 +#define GLM_ARCH_SSE2 0x0001 +#define GLM_ARCH_SSE3 0x0002 | GLM_ARCH_SSE2 +#define GLM_ARCH_AVX 0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_M_IX86)) # if(GLM_COMPILER >= GLM_COMPILER_VC2010) # if(_M_IX86_FP == 3) //AVX -# define GLM_SUPPORT GLM_SUPPORT_AVX //GLM_SUPPORT_AVX (Require SP1) +# define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1) # else -# define GLM_SUPPORT GLM_SUPPORT_SSE3 +# define GLM_ARCH GLM_ARCH_SSE3 # endif # elif(GLM_COMPILER >= GLM_COMPILER_VC2008) -# define GLM_SUPPORT GLM_SUPPORT_SSE3 +# define GLM_ARCH GLM_ARCH_SSE3 # elif(GLM_COMPILER >= GLM_COMPILER_VC2005) -# define GLM_SUPPORT GLM_SUPPORT_SSE2 +# define GLM_ARCH GLM_ARCH_SSE2 # else -# define GLM_SUPPORT GLM_SUPPORT_PURE +# define GLM_ARCH GLM_ARCH_PURE # endif #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) # if(GLM_COMPILER >= GLM_COMPILER_GCC44) -# define GLM_SUPPORT GLM_SUPPORT_AVX +# define GLM_ARCH GLM_ARCH_AVX # elif(GLM_COMPILER >= GLM_COMPILER_GCC40) -# define GLM_SUPPORT GLM_SUPPORT_SSE3 +# define GLM_ARCH GLM_ARCH_SSE3 # else -# define GLM_SUPPORT GLM_SUPPORT_PURE +# define GLM_ARCH GLM_ARCH_PURE # endif #else -# define GLM_SUPPORT GLM_SUPPORT_PURE +# define GLM_ARCH GLM_ARCH_PURE #endif -#define GLM_ARCH_PURE 0 -#define GLM_ARCH_SSE2 1 -#define GLM_ARCH_SSE3 2 -#define GLM_ARCH_AVX 3 - -#if(GLM_SUPPORT == GLM_SUPPORT_AVX) +#if(GLM_ARCH != GLM_ARCH_PURE) +#if(GLM_ARCH & GLM_ARCH_AVX) # include -# define GLM_ARCH GLM_ARCH_AVX -#elif(GLM_SUPPORT == GLM_SUPPORT_SSE3) +#endif//GLM_ARCH +#if(GLM_ARCH & GLM_ARCH_SSE3) # include -# define GLM_ARCH GLM_ARCH_SSE3 -#elif((GLM_SUPPORT == GLM_SUPPORT_SSE2) || (GLM_MODEL == GLM_MODEL_64)) +#endif//GLM_ARCH +#if(GLM_ARCH & GLM_ARCH_SSE2) # include -# define GLM_ARCH GLM_ARCH_SSE2 -#else -# define GLM_ARCH GLM_ARCH_PURE -#endif//GLM_SUPPORT +#endif//GLM_ARCH +#endif//(GLM_ARCH != GLM_ARCH_PURE) #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)) # define GLM_MESSAGE_ARCH_DISPLAYED