Browse Source

Updated architechture detection and checking

Christophe Riccio 15 years ago
parent
commit
dc979ddfaf
3 changed files with 31 additions and 27 deletions
  1. 5 0
      glm/gtx/simd_mat4.hpp
  2. 5 0
      glm/gtx/simd_vec4.hpp
  3. 21 27
      glm/setup.hpp

+ 5 - 0
glm/gtx/simd_mat4.hpp

@@ -16,6 +16,11 @@
 
 
 // Dependency:
 // Dependency:
 #include "../glm.hpp"
 #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 "../core/intrinsic_matrix.hpp"
 #include "../gtx/simd_vec4.hpp"
 #include "../gtx/simd_vec4.hpp"
 
 

+ 5 - 0
glm/gtx/simd_vec4.hpp

@@ -16,6 +16,11 @@
 
 
 // Dependency:
 // Dependency:
 #include "../glm.hpp"
 #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_common.hpp"
 #include "../core/intrinsic_geometric.hpp"
 #include "../core/intrinsic_geometric.hpp"
 
 

+ 21 - 27
glm/setup.hpp

@@ -254,54 +254,48 @@
 /////////////////
 /////////////////
 // Platform 
 // 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_VC) && defined(_M_IX86))
 #	if(GLM_COMPILER >= GLM_COMPILER_VC2010)
 #	if(GLM_COMPILER >= GLM_COMPILER_VC2010)
 #		if(_M_IX86_FP == 3) //AVX
 #		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
 #		else
-#			define GLM_SUPPORT GLM_SUPPORT_SSE3
+#			define GLM_ARCH GLM_ARCH_SSE3
 #		endif
 #		endif
 #	elif(GLM_COMPILER >= GLM_COMPILER_VC2008) 
 #	elif(GLM_COMPILER >= GLM_COMPILER_VC2008) 
-#		define GLM_SUPPORT GLM_SUPPORT_SSE3
+#		define GLM_ARCH GLM_ARCH_SSE3
 #	elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
 #	elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
-#		define GLM_SUPPORT GLM_SUPPORT_SSE2
+#		define GLM_ARCH GLM_ARCH_SSE2
 #	else
 #	else
-#		define GLM_SUPPORT GLM_SUPPORT_PURE
+#		define GLM_ARCH GLM_ARCH_PURE
 #	endif
 #	endif
 #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
 #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
 #	if(GLM_COMPILER >= GLM_COMPILER_GCC44)
 #	if(GLM_COMPILER >= GLM_COMPILER_GCC44)
-#		define GLM_SUPPORT GLM_SUPPORT_AVX
+#		define GLM_ARCH GLM_ARCH_AVX
 #	elif(GLM_COMPILER >= GLM_COMPILER_GCC40)
 #	elif(GLM_COMPILER >= GLM_COMPILER_GCC40)
-#		define GLM_SUPPORT GLM_SUPPORT_SSE3
+#		define GLM_ARCH GLM_ARCH_SSE3
 #	else
 #	else
-#		define GLM_SUPPORT GLM_SUPPORT_PURE
+#		define GLM_ARCH GLM_ARCH_PURE
 #	endif
 #	endif
 #else
 #else
-#	define GLM_SUPPORT GLM_SUPPORT_PURE
+#	define GLM_ARCH GLM_ARCH_PURE
 #endif
 #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 <immintrin.h>
 #	include <immintrin.h>
-#	define GLM_ARCH GLM_ARCH_AVX
-#elif(GLM_SUPPORT == GLM_SUPPORT_SSE3)
+#endif//GLM_ARCH
+#if(GLM_ARCH & GLM_ARCH_SSE3)
 #	include <pmmintrin.h>
 #	include <pmmintrin.h>
-#	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 <emmintrin.h>
 #	include <emmintrin.h>
-#	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))
 #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
 #	define GLM_MESSAGE_ARCH_DISPLAYED
 #	define GLM_MESSAGE_ARCH_DISPLAYED