Browse Source

Updated SIMD operations

Christophe Riccio 15 years ago
parent
commit
7ba75dff4b
3 changed files with 26 additions and 29 deletions
  1. 1 1
      glm/gtx/simd_mat4.hpp
  2. 23 26
      glm/gtx/simd_vec4.hpp
  3. 2 2
      glm/gtx/simd_vec4.inl

+ 1 - 1
glm/gtx/simd_mat4.hpp

@@ -41,7 +41,7 @@ namespace glm
 			static size_type row_size();
 			static size_type row_size();
 			static bool is_matrix();
 			static bool is_matrix();
 
 
-			fvec4SIMD Data[4];
+			fvec4SIMD value[4];
 
 
 			//////////////////////////////////////
 			//////////////////////////////////////
 			// Constructors
 			// Constructors

+ 23 - 26
glm/gtx/simd_vec4.hpp

@@ -22,16 +22,23 @@ namespace glm
 {
 {
 	namespace detail
 	namespace detail
 	{
 	{
-		GLM_ALIGN(4) struct fvec4SIMD
+		GLM_ALIGN(4) union fvec4SIMD
 		{
 		{
+			enum ctor{null};
+			typedef float value_type;
+			typedef std::size_t size_type;
+			static size_type value_size();
+
+			typedef fvec4SIMD type;
+			typedef tvec4<bool> bool_type;
+
 			static __m128 one;
 			static __m128 one;
 
 
-			union
-			{
-				__m128 Data;
-				struct{float x, y, z, w;};
-				float array[4];
-			};
+			__m128 Data;
+			float Array[4];
+			struct{float x, y, z, w;};
+			struct{float r, g, b, a;};
+			struct{float s, t, q, p;};
 
 
 			//////////////////////////////////////
 			//////////////////////////////////////
 			// Implicit basic constructors
 			// Implicit basic constructors
@@ -44,9 +51,15 @@ namespace glm
 			//////////////////////////////////////
 			//////////////////////////////////////
 			// Explicit basic constructors
 			// Explicit basic constructors
 
 
-			fvec4SIMD(float const & s);
-			fvec4SIMD(float const & x, float const & y, float const & z, float const & w);
-			fvec4SIMD(float const v[4]);
+			explicit fvec4SIMD(
+				ctor);
+			explicit fvec4SIMD(
+				float const & s);
+			explicit fvec4SIMD(
+				float const & x, 
+				float const & y, 
+				float const & z, 
+				float const & w);
 
 
 			////////////////////////////////////////
 			////////////////////////////////////////
 			//// Swizzle constructors
 			//// Swizzle constructors
@@ -81,22 +94,6 @@ namespace glm
 			fvec4SIMD& operator++();
 			fvec4SIMD& operator++();
 			fvec4SIMD& operator--();
 			fvec4SIMD& operator--();
 
 
-			////////////////////////////////////////
-			//// Unary bit operators
-
-			//fvec4SIMD& operator%= (float s);
-			//fvec4SIMD& operator%= (fvec4SIMD const & v);
-			//fvec4SIMD& operator&= (float s);
-			//fvec4SIMD& operator&= (fvec4SIMD const & v);
-			//fvec4SIMD& operator|= (float s);
-			//fvec4SIMD& operator|= (fvec4SIMD const & v);
-			//fvec4SIMD& operator^= (float s);
-			//fvec4SIMD& operator^= (fvec4SIMD const & v);
-			//fvec4SIMD& operator<<=(float s);
-			//fvec4SIMD& operator<<=(fvec4SIMD const & v);
-			//fvec4SIMD& operator>>=(float s);
-			//fvec4SIMD& operator>>=(fvec4SIMD const & v);
-
 			//////////////////////////////////////
 			//////////////////////////////////////
 			// Swizzle operators
 			// Swizzle operators
 
 

+ 2 - 2
glm/gtx/simd_vec4.inl

@@ -42,11 +42,11 @@ namespace glm
 	//		Data(_mm_setr_ps(x, y, z, w))
 	//		Data(_mm_setr_ps(x, y, z, w))
 			Data(_mm_set_ps(w, z, y, x))
 			Data(_mm_set_ps(w, z, y, x))
 		{}
 		{}
-
+/*
 		inline fvec4SIMD::fvec4SIMD(float const v[4]) :
 		inline fvec4SIMD::fvec4SIMD(float const v[4]) :
 			Data(_mm_load_ps(v))
 			Data(_mm_load_ps(v))
 		{}
 		{}
-
+*/
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Swizzle constructors
 		// Swizzle constructors