Fixed Visual C++ vec4 simd specification code path

This commit is contained in:
Christophe Riccio 2013-12-26 13:39:04 +01:00
parent 5f1bb47bf2
commit d01630079c
3 changed files with 3 additions and 24 deletions

View File

@ -93,6 +93,7 @@ namespace detail
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
union union
{ {
typename simd<T>::type data;
struct { T r, g, b, a; }; struct { T r, g, b, a; };
struct { T s, t, p, q; }; struct { T s, t, p, q; };
struct { T x, y, z, w;}; struct { T x, y, z, w;};

View File

@ -108,13 +108,13 @@ namespace detail
template <> template <>
template <precision Q> template <precision Q>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(tvec4<float, Q> const & v) : GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(tvec4<float, Q> const & v) :
data(_mm_set_ps(w, z, y, x)) data(_mm_set_ps(v.w, v.z, v.y, v.x))
{} {}
template <> template <>
template <precision Q> template <precision Q>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(tvec4<float, Q> const & v) : GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(tvec4<float, Q> const & v) :
data(_mm_set_ps(w, z, y, x)) data(_mm_set_ps(v.w, v.z, v.y, v.x))
{} {}
#endif #endif

View File

@ -13,30 +13,8 @@
#if(GLM_ARCH != GLM_ARCH_PURE) #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() 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 A1(0.0f, 0.1f, 0.2f, 0.3f);
glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f); glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
glm::simdVec4 C1 = A1 + B1; glm::simdVec4 C1 = A1 + B1;