From 7ba75dff4b06bd32760859c07912a12b52997a70 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 13 Dec 2010 18:34:02 +0000 Subject: [PATCH] Updated SIMD operations --- glm/gtx/simd_mat4.hpp | 2 +- glm/gtx/simd_vec4.hpp | 49 ++++++++++++++++++++----------------------- glm/gtx/simd_vec4.inl | 4 ++-- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 8e99647d..ee5b2bc0 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -41,7 +41,7 @@ namespace glm static size_type row_size(); static bool is_matrix(); - fvec4SIMD Data[4]; + fvec4SIMD value[4]; ////////////////////////////////////// // Constructors diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index a67a1b0d..997fb1d1 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -22,16 +22,23 @@ namespace glm { 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_type; + 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 @@ -44,9 +51,15 @@ namespace glm ////////////////////////////////////// // 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 @@ -81,22 +94,6 @@ namespace glm 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 diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index ab572e4a..58070f93 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -42,11 +42,11 @@ namespace glm // Data(_mm_setr_ps(x, y, z, w)) Data(_mm_set_ps(w, z, y, x)) {} - +/* inline fvec4SIMD::fvec4SIMD(float const v[4]) : Data(_mm_load_ps(v)) {} - +*/ ////////////////////////////////////// // Swizzle constructors