From d01630079c4735e6ca2ca7bc2a9d3b3cbe2e6c5e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 26 Dec 2013 13:39:04 +0100 Subject: [PATCH] Fixed Visual C++ vec4 simd specification code path --- glm/detail/type_vec4.hpp | 1 + glm/detail/type_vec4.inl | 4 ++-- test/gtx/gtx_simd_vec4.cpp | 22 ---------------------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 2bc1ca59..00fcfe06 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -93,6 +93,7 @@ namespace detail # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) union { + typename simd::type data; struct { T r, g, b, a; }; struct { T s, t, p, q; }; struct { T x, y, z, w;}; diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index ed26032c..afc26ba7 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -108,13 +108,13 @@ namespace detail template <> template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) : - data(_mm_set_ps(w, z, y, x)) + data(_mm_set_ps(v.w, v.z, v.y, v.x)) {} template <> template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) : - data(_mm_set_ps(w, z, y, x)) + data(_mm_set_ps(v.w, v.z, v.y, v.x)) {} #endif diff --git a/test/gtx/gtx_simd_vec4.cpp b/test/gtx/gtx_simd_vec4.cpp index 36e3a9e5..0f733ef9 100644 --- a/test/gtx/gtx_simd_vec4.cpp +++ b/test/gtx/gtx_simd_vec4.cpp @@ -13,30 +13,8 @@ #if(GLM_ARCH != GLM_ARCH_PURE) - -struct value -{ - value(float x, float y, float z, float w) : - x(x), y(y), z(z), w(w) - {} - - union - { - __m128 data; - struct - { - union { float x, r, s; }; - union { float y, g, t; }; - union { float z, b, p; }; - union { float w, a, q; }; - }; - }; -}; - int main() { - value Value(1.0, 0.5, 0.0, 0.7); - glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f); glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f); glm::simdVec4 C1 = A1 + B1;