Browse Source

Fixed SSE detection on GCC

Christophe Riccio 15 years ago
parent
commit
019c6ced18
4 changed files with 13 additions and 9 deletions
  1. 2 2
      glm/gtc/half_float.hpp
  2. 2 2
      glm/gtc/half_float.inl
  3. 7 3
      glm/setup.hpp
  4. 2 2
      test/core/core_type_half.cpp

+ 2 - 2
glm/gtc/half_float.hpp

@@ -25,7 +25,7 @@ namespace glm
 
 	namespace detail
 	{
-#ifndef GLM_USE_ANONYMOUS_UNION
+#ifndef _MSC_EXTENSIONS
 		template <>
 		struct tvec2<thalf>
 		{
@@ -319,7 +319,7 @@ namespace glm
 			tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
 			tref4<thalf> swizzle(comp X, comp Y, comp Z, comp W);
 		};
-#endif//GLM_USE_ANONYMOUS_UNION
+#endif//_MSC_EXTENSIONS
 	}
 	//namespace detail
 

+ 2 - 2
glm/gtc/half_float.inl

@@ -10,7 +10,7 @@
 namespace glm{
 namespace detail{
 
-#ifndef GLM_USE_ANONYMOUS_UNION
+#ifndef _MSC_EXTENSIONS
 
 //////////////////////////////////////
 // hvec2
@@ -969,7 +969,7 @@ inline tref4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w)
 		(*this)[w]);
 }
 
-#endif//GLM_USE_ANONYMOUS_UNION
+#endif//_MSC_EXTENSIONS
 
 }//namespace detail
 }//namespace glm

+ 7 - 3
glm/setup.hpp

@@ -262,10 +262,12 @@
 #		define GLM_ARCH GLM_ARCH_PURE
 #	endif
 #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
-#	if(GLM_COMPILER >= GLM_COMPILER_GCC44)
+#	if(defined(__AVX__))
 #		define GLM_ARCH GLM_ARCH_AVX
-#	elif(GLM_COMPILER >= GLM_COMPILER_GCC40)
+#	elif(defined(__SSE3__))
 #		define GLM_ARCH GLM_ARCH_SSE3
+#	elif(defined(__SSE2__))
+#		define GLM_ARCH GLM_ARCH_SSE2
 #	else
 #		define GLM_ARCH GLM_ARCH_PURE
 #	endif
@@ -340,8 +342,10 @@
 #	define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
 #elif(defined(BOOST_STATIC_ASSERT))
 #	define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
-#else
+#elif(GLM_COMPILER & GLM_COMPILER_VC)
 #	define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
+#else
+#	define GLM_STATIC_ASSERT(x, message)
 #endif//GLM_LANG
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////

+ 2 - 2
test/core/core_type_half.cpp

@@ -19,12 +19,12 @@ int main()
 	glm::half C = A + B;
 	glm::half D(C);
 	float E = D;
-	int F = C;
+	int F = float(C);
 	glm::half G = B * C;
 	glm::half H = G / C;
 	H += glm::half(1.0f);
 	double J = H;
-	int I = H;
+	int I = float(H);
 
 	Result = Result && J == 3.0;