Flow Visualisation
simd_vec4.hpp
Go to the documentation of this file.
1 
38 #ifndef GLM_GTX_simd_vec4
39 #define GLM_GTX_simd_vec4 GLM_VERSION
40 
41 // Dependency:
42 #include "../glm.hpp"
43 
44 #if(GLM_ARCH != GLM_ARCH_PURE)
45 
46 #if(GLM_ARCH & GLM_ARCH_SSE2)
47 # include "../core/intrinsic_common.hpp"
48 # include "../core/intrinsic_geometric.hpp"
49 #else
50 # error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics"
51 #endif
52 
53 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
54 # pragma message("GLM: GLM_GTX_simd_vec4 extension included")
55 #endif
56 
57 
58 // Warning silencer for nameless struct/union.
59 #if (GLM_COMPILER & GLM_COMPILER_VC)
60 # pragma warning(push)
61 # pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
62 #endif
63 
64 
65 namespace glm{
66 namespace detail
67 {
70  GLM_ALIGNED_STRUCT(16) fvec4SIMD
71  {
72  enum ctor{null};
73  typedef __m128 value_type;
74  typedef std::size_t size_type;
75  static size_type value_size();
76 
77  typedef fvec4SIMD type;
78  typedef tvec4<bool> bool_type;
79 
80 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
81  union
82  {
83  __m128 Data;
84  struct {float x, y, z, w;};
85  };
86 #else
87  __m128 Data;
88 #endif
89 
91  // Implicit basic constructors
92 
93  fvec4SIMD();
94  fvec4SIMD(__m128 const & Data);
95  fvec4SIMD(fvec4SIMD const & v);
96 
98  // Explicit basic constructors
99 
100  explicit fvec4SIMD(
101  ctor);
102  explicit fvec4SIMD(
103  float const & s);
104  explicit fvec4SIMD(
105  float const & x,
106  float const & y,
107  float const & z,
108  float const & w);
109  explicit fvec4SIMD(
110  tvec4<float> const & v);
111 
114 
115  fvec4SIMD(vec2 const & v, float const & s1, float const & s2);
116  fvec4SIMD(float const & s1, vec2 const & v, float const & s2);
117  fvec4SIMD(float const & s1, float const & s2, vec2 const & v);
118  fvec4SIMD(vec3 const & v, float const & s);
119  fvec4SIMD(float const & s, vec3 const & v);
120  fvec4SIMD(vec2 const & v1, vec2 const & v2);
121  //fvec4SIMD(ivec4SIMD const & v);
122 
124  // Unary arithmetic operators
125 
126  fvec4SIMD& operator= (fvec4SIMD const & v);
127  fvec4SIMD& operator+=(fvec4SIMD const & v);
128  fvec4SIMD& operator-=(fvec4SIMD const & v);
129  fvec4SIMD& operator*=(fvec4SIMD const & v);
130  fvec4SIMD& operator/=(fvec4SIMD const & v);
131 
132  fvec4SIMD& operator+=(float const & s);
133  fvec4SIMD& operator-=(float const & s);
134  fvec4SIMD& operator*=(float const & s);
135  fvec4SIMD& operator/=(float const & s);
136 
137  fvec4SIMD& operator++();
138  fvec4SIMD& operator--();
139 
141  // Swizzle operators
142 
143  template <comp X, comp Y, comp Z, comp W>
144  fvec4SIMD& swizzle();
145  template <comp X, comp Y, comp Z, comp W>
146  fvec4SIMD swizzle() const;
147  template <comp X, comp Y, comp Z>
148  fvec4SIMD swizzle() const;
149  template <comp X, comp Y>
150  fvec4SIMD swizzle() const;
151  template <comp X>
152  fvec4SIMD swizzle() const;
153  };
154 }//namespace detail
155 
156  typedef glm::detail::fvec4SIMD simdVec4;
157 
160 
163  detail::tvec4<float> vec4_cast(
164  detail::fvec4SIMD const & x);
165 
168  detail::fvec4SIMD abs(detail::fvec4SIMD const & x);
169 
172  detail::fvec4SIMD sign(detail::fvec4SIMD const & x);
173 
176  detail::fvec4SIMD floor(detail::fvec4SIMD const & x);
177 
181  detail::fvec4SIMD trunc(detail::fvec4SIMD const & x);
182 
189  detail::fvec4SIMD round(detail::fvec4SIMD const & x);
190 
195  //detail::fvec4SIMD roundEven(detail::fvec4SIMD const & x);
196 
200  detail::fvec4SIMD ceil(detail::fvec4SIMD const & x);
201 
204  detail::fvec4SIMD fract(detail::fvec4SIMD const & x);
205 
209  detail::fvec4SIMD mod(
210  detail::fvec4SIMD const & x,
211  detail::fvec4SIMD const & y);
212 
216  detail::fvec4SIMD mod(
217  detail::fvec4SIMD const & x,
218  float const & y);
219 
225  //detail::fvec4SIMD modf(
226  // detail::fvec4SIMD const & x,
227  // detail::fvec4SIMD & i);
228 
231  detail::fvec4SIMD min(
232  detail::fvec4SIMD const & x,
233  detail::fvec4SIMD const & y);
234 
235  detail::fvec4SIMD min(
236  detail::fvec4SIMD const & x,
237  float const & y);
238 
241  detail::fvec4SIMD max(
242  detail::fvec4SIMD const & x,
243  detail::fvec4SIMD const & y);
244 
245  detail::fvec4SIMD max(
246  detail::fvec4SIMD const & x,
247  float const & y);
248 
252  detail::fvec4SIMD clamp(
253  detail::fvec4SIMD const & x,
254  detail::fvec4SIMD const & minVal,
255  detail::fvec4SIMD const & maxVal);
256 
257  detail::fvec4SIMD clamp(
258  detail::fvec4SIMD const & x,
259  float const & minVal,
260  float const & maxVal);
261 
285  // \todo Test when 'a' is a boolean.
287  detail::fvec4SIMD mix(
288  detail::fvec4SIMD const & x,
289  detail::fvec4SIMD const & y,
290  detail::fvec4SIMD const & a);
291 
294  detail::fvec4SIMD step(
295  detail::fvec4SIMD const & edge,
296  detail::fvec4SIMD const & x);
297 
298  detail::fvec4SIMD step(
299  float const & edge,
300  detail::fvec4SIMD const & x);
301 
312  detail::fvec4SIMD smoothstep(
313  detail::fvec4SIMD const & edge0,
314  detail::fvec4SIMD const & edge1,
315  detail::fvec4SIMD const & x);
316 
317  detail::fvec4SIMD smoothstep(
318  float const & edge0,
319  float const & edge1,
320  detail::fvec4SIMD const & x);
321 
328  //bvec4 isnan(detail::fvec4SIMD const & x);
329 
336  //bvec4 isinf(detail::fvec4SIMD const & x);
337 
342  //detail::ivec4SIMD floatBitsToInt(detail::fvec4SIMD const & value);
343 
350  //detail::fvec4SIMD intBitsToFloat(detail::ivec4SIMD const & value);
351 
354  detail::fvec4SIMD fma(
355  detail::fvec4SIMD const & a,
356  detail::fvec4SIMD const & b,
357  detail::fvec4SIMD const & c);
358 
368  //detail::fvec4SIMD frexp(detail::fvec4SIMD const & x, detail::ivec4SIMD & exp);
369 
376  //detail::fvec4SIMD ldexp(detail::fvec4SIMD const & x, detail::ivec4SIMD const & exp);
377 
380  float length(
381  detail::fvec4SIMD const & x);
382 
386  float fastLength(
387  detail::fvec4SIMD const & x);
388 
392  float niceLength(
393  detail::fvec4SIMD const & x);
394 
397  detail::fvec4SIMD length4(
398  detail::fvec4SIMD const & x);
399 
403  detail::fvec4SIMD fastLength4(
404  detail::fvec4SIMD const & x);
405 
409  detail::fvec4SIMD niceLength4(
410  detail::fvec4SIMD const & x);
411 
414  float distance(
415  detail::fvec4SIMD const & p0,
416  detail::fvec4SIMD const & p1);
417 
420  detail::fvec4SIMD distance4(
421  detail::fvec4SIMD const & p0,
422  detail::fvec4SIMD const & p1);
423 
426  float simdDot(
427  detail::fvec4SIMD const & x,
428  detail::fvec4SIMD const & y);
429 
432  detail::fvec4SIMD dot4(
433  detail::fvec4SIMD const & x,
434  detail::fvec4SIMD const & y);
435 
438  detail::fvec4SIMD cross(
439  detail::fvec4SIMD const & x,
440  detail::fvec4SIMD const & y);
441 
444  detail::fvec4SIMD normalize(
445  detail::fvec4SIMD const & x);
446 
450  detail::fvec4SIMD fastNormalize(
451  detail::fvec4SIMD const & x);
452 
455  detail::fvec4SIMD simdFaceforward(
456  detail::fvec4SIMD const & N,
457  detail::fvec4SIMD const & I,
458  detail::fvec4SIMD const & Nref);
459 
463  detail::fvec4SIMD reflect(
464  detail::fvec4SIMD const & I,
465  detail::fvec4SIMD const & N);
466 
471  detail::fvec4SIMD refract(
472  detail::fvec4SIMD const & I,
473  detail::fvec4SIMD const & N,
474  float const & eta);
475 
478  detail::fvec4SIMD sqrt(
479  detail::fvec4SIMD const & x);
480 
484  detail::fvec4SIMD niceSqrt(
485  detail::fvec4SIMD const & x);
486 
490  detail::fvec4SIMD fastSqrt(
491  detail::fvec4SIMD const & x);
492 
495  detail::fvec4SIMD inversesqrt(
496  detail::fvec4SIMD const & x);
497 
501  detail::fvec4SIMD fastInversesqrt(
502  detail::fvec4SIMD const & x);
503 
505 }//namespace glm
506 
507 #include "simd_vec4.inl"
508 
509 
510 #if (GLM_COMPILER & GLM_COMPILER_VC)
511 # pragma warning(pop)
512 #endif
513 
514 
515 #endif//(GLM_ARCH != GLM_ARCH_PURE)
516 
517 #endif//GLM_GTX_simd_vec4
GLM_FUNC_QUALIFIER detail::fvec4SIMD dot4(detail::fvec4SIMD const &x, detail::fvec4SIMD const &y)
Definition: simd_vec4.inl:626
GLM_FUNC_DECL half operator--(half const &s, int)
Definition: type_half.inl:356
GLM_FUNC_QUALIFIER detail::fvec4SIMD distance4(detail::fvec4SIMD const &p0, detail::fvec4SIMD const &p1)
Definition: simd_vec4.inl:606
GLM_FUNC_DECL genType round(genType const &x)
Definition: func_common.inl:126
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
Definition: func_common.inl:286
#define GLM_ALIGNED_STRUCT(x)
Definition: _detail.hpp:476
GLM_FUNC_DECL genType refract(genType const &I, genType const &N, typename genType::value_type const &eta)
Definition: func_geometric.inl:304
GLM_FUNC_DECL genType mod(genType const &x, genType const &y)
Definition: func_common.inl:210
GLM_FUNC_DECL genType reflect(genType const &I, genType const &N)
Definition: func_geometric.inl:274
GLM_FUNC_DECL genType trunc(genType const &x)
Definition: func_common.inl:116
Definition: _detail.hpp:38
GLM_FUNC_QUALIFIER detail::fvec4SIMD fastInversesqrt(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:722
GLM_FUNC_DECL genType::value_type distance(genType const &p0, genType const &p1)
Definition: func_geometric.inl:83
mediump_vec2 vec2
Definition: type.hpp:104
GLM_FUNC_QUALIFIER detail::fvec4SIMD fastLength4(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:579
GLM_FUNC_DECL genType step(genType const &edge, genType const &x)
Definition: func_common.inl:652
GLM_FUNC_DECL genType sign(genType const &x)
GLM_FUNC_QUALIFIER float niceLength(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:559
GLM_FUNC_DECL genType fract(genType const &x)
Definition: func_common.inl:196
GLM_FUNC_DECL genType normalize(genType const &x)
Definition: func_geometric.inl:213
GLM_FUNC_DECL half operator++(half const &s, int)
Definition: type_half.inl:361
GLM_FUNC_DECL genType floor(genType const &x)
Definition: func_common.inl:105
GLM_FUNC_DECL genType abs(genType const &x)
GLM_FUNC_DECL genType clamp(genType const &x, genType const &minVal, genType const &maxVal)
GLM_FUNC_QUALIFIER detail::fvec4SIMD niceSqrt(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:699
GLM_FUNC_QUALIFIER detail::tvec4< float > vec4_cast(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:273
genType fastNormalize(genType const &x)
Definition: fast_square_root.inl:100
genType fastSqrt(genType const &x)
Definition: fast_square_root.inl:15
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
Definition: func_common.inl:305
GLM_FUNC_DECL genType inversesqrt(genType const &x)
Definition: func_exponential.inl:144
mediump_vec3 vec3
Definition: type.hpp:109
GLM_FUNC_DECL genType sqrt(genType const &x)
Definition: func_exponential.inl:131
GLM_FUNC_DECL genTypeT mix(genTypeT const &x, genTypeT const &y, genTypeU const &a)
GLM_FUNC_DECL genType::value_type length(genType const &x)
Definition: func_geometric.inl:34
T const & swizzle(vecType< T > const &v, comp x)
Definition: swizzle.inl:33
genType::value_type fastLength(genType const &x)
Definition: fast_square_root.inl:49
GLM_FUNC_DECL detail::tvec3< valType > cross(detail::tvec3< valType > const &x, detail::tvec3< valType > const &y)
GLM_FUNC_DECL genType fma(genType const &a, genType const &b, genType const &c)
Definition: func_common.inl:1137
GLM_FUNC_DECL genType ceil(genType const &x)
Definition: func_common.inl:184
GLM_FUNC_QUALIFIER detail::fvec4SIMD niceLength4(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:587
GLM_FUNC_DECL genType smoothstep(genType const &edge0, genType const &edge1, genType const &x)
Definition: func_common.inl:743
GLM_FUNC_QUALIFIER detail::fvec4SIMD length4(detail::fvec4SIMD const &x)
Definition: simd_vec4.inl:571