Bladeren bron

Fixed constexpr with SIMD interaction

Christophe Riccio 9 jaren geleden
bovenliggende
commit
a6047251be
4 gewijzigde bestanden met toevoegingen van 15 en 9 verwijderingen
  1. 8 2
      glm/detail/setup.hpp
  2. 2 2
      glm/detail/type_vec4.hpp
  3. 2 2
      glm/detail/type_vec4.inl
  4. 3 3
      glm/detail/type_vec4_simd.inl

+ 8 - 2
glm/detail/setup.hpp

@@ -737,11 +737,17 @@
 #	define GLM_RELAXED_CONSTEXPR const
 #endif
 
+#if GLM_ARCH == GLM_ARCH_PURE
+#	define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR
+#else
+#	define GLM_CONSTEXPR_SIMD
+#endif
+
 // GCC 4.6 has a bug causing a compiler crash
 #if GLM_COMPILER & GLM_COMPILER_GCC
-#	define	GLM_CONSTEXPR_GCC
+#	define GLM_CONSTEXPR_GCC
 #else
-#	define	GLM_CONSTEXPR_GCC GLM_CONSTEXPR
+#	define GLM_CONSTEXPR_GCC GLM_CONSTEXPR
 #endif
 
 #ifdef GLM_FORCE_EXPLICIT_CTOR

+ 2 - 2
glm/detail/type_vec4.hpp

@@ -158,8 +158,8 @@ namespace detail
 		// -- Explicit basic constructors --
 
 		GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(ctor);
-		GLM_FUNC_DECL GLM_CONSTEXPR_GCC explicit tvec4(T scalar);
-		GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d);
+		GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec4(T scalar);
+		GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(T a, T b, T c, T d);
 
 		// -- Conversion scalar constructors --
 

+ 2 - 2
glm/detail/type_vec4.inl

@@ -63,12 +63,12 @@ namespace glm
 	{}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec4<T, P>::tvec4(T scalar)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(T scalar)
 		: x(scalar), y(scalar), z(scalar), w(scalar)
 	{}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<T, P>::tvec4(T a, T b, T c, T d)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<T, P>::tvec4(T a, T b, T c, T d)
 		: x(a), y(b), z(c), w(d)
 	{}
 

+ 3 - 3
glm/detail/type_vec4_simd.inl

@@ -36,7 +36,7 @@ namespace glm
 
 #	if !GLM_HAS_DEFAULTED_FUNCTIONS
 		template <>
-		GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<float, simd>::tvec4()
+		GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<float, simd>::tvec4()
 #			ifndef GLM_FORCE_NO_CTOR_INIT
 				: data(_mm_setzero_ps())
 #			endif
@@ -44,12 +44,12 @@ namespace glm
 #	endif//!GLM_HAS_DEFAULTED_FUNCTIONS
 
 	template <>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec4<float, simd>::tvec4(float s) :
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, simd>::tvec4(float s) :
 		data(_mm_set1_ps(s))
 	{}
 
 	template <>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<float, simd>::tvec4(float a, float b, float c, float d) :
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, simd>::tvec4(float a, float b, float c, float d) :
 		data(_mm_set_ps(d, c, b, a))
 	{}