glm/test/gtx/gtx_simd_vec4.cpp

72 lines
1.7 KiB
C++
Raw Normal View History

2010-12-17 01:33:17 +00:00
///////////////////////////////////////////////////////////////////////////////////////////////////
2013-02-20 15:21:56 +00:00
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
2010-12-17 01:33:17 +00:00
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2010-09-16
// Updated : 2010-09-16
// Licence : This source is under MIT licence
// File : test/gtx/simd-vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>
2011-10-18 10:21:34 +00:00
#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; };
};
};
};
2011-01-24 15:44:14 +00:00
int main()
2010-12-17 01:33:17 +00:00
{
value Value(1.0, 0.5, 0.0, 0.7);
2011-01-31 12:21:11 +00:00
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;
glm::simdVec4 D1 = A1.swizzle<glm::X, glm::Z, glm::Y, glm::W>();
glm::simdVec4 E1(glm::vec4(1.0f));
glm::vec4 F1 = glm::vec4_cast(E1);
2011-01-31 12:21:11 +00:00
//glm::vec4 G1(E1);
2010-12-17 01:33:17 +00:00
2011-01-31 12:21:11 +00:00
//printf("A1(%2.3f, %2.3f, %2.3f, %2.3f)\n", A1.x, A1.y, A1.z, A1.w);
//printf("B1(%2.3f, %2.3f, %2.3f, %2.3f)\n", B1.x, B1.y, B1.z, B1.w);
//printf("C1(%2.3f, %2.3f, %2.3f, %2.3f)\n", C1.x, C1.y, C1.z, C1.w);
//printf("D1(%2.3f, %2.3f, %2.3f, %2.3f)\n", D1.x, D1.y, D1.z, D1.w);
2010-12-17 01:33:17 +00:00
2013-11-10 12:47:13 +00:00
__m128 value;
__m128 data = _mm_cmpeq_ps(value, value);
__m128 add0 = _mm_add_ps(data, data);
glm::simdVec4 GNI(add0);
2010-12-17 01:33:17 +00:00
return 0;
}
2011-10-18 10:21:34 +00:00
#else
int main()
{
int Error = 0;
return Error;
}
#endif//(GLM_ARCH != GLM_ARCH_PURE)