1 #ifndef _TCUVECTORUTIL_HPP
2 #define _TCUVECTORUTIL_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
6 *
7 * Copyright 2014 The Android Open Source Project
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *//*!
22 * \file
23 * \brief Vector utility functions.
24 *//*--------------------------------------------------------------------*/
25
26 #include "tcuDefs.hpp"
27 #include "tcuVector.hpp"
28 #include "deRandom.hpp"
29 #include "deMeta.hpp"
30 #include "deMath.h"
31 #include "deInt32.h"
32
33 #include <ostream>
34 #include <math.h>
35
36 namespace tcu
37 {
38
39 static const float PI = 3.141592653589793238f;
40
41 #if (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_QNX) || \
42 (DE_OS == DE_OS_WIN32 && DE_COMPILER == DE_COMPILER_CLANG)
abs(float f)43 inline float abs(float f)
44 {
45 return deFloatAbs(f);
46 }
47 #endif
48
49 template <typename T>
add(T a,T b)50 inline T add(T a, T b)
51 {
52 return a + b;
53 }
54 template <typename T>
sub(T a,T b)55 inline T sub(T a, T b)
56 {
57 return a - b;
58 }
59 template <typename T>
mul(T a,T b)60 inline T mul(T a, T b)
61 {
62 return a * b;
63 }
64 template <typename T>
div(T a,T b)65 inline T div(T a, T b)
66 {
67 return a / b;
68 }
69
70 template <typename T>
bitwiseNot(T a)71 inline T bitwiseNot(T a)
72 {
73 return ~a;
74 }
75 template <typename T>
bitwiseAnd(T a,T b)76 inline T bitwiseAnd(T a, T b)
77 {
78 return a & b;
79 }
80 template <typename T>
bitwiseOr(T a,T b)81 inline T bitwiseOr(T a, T b)
82 {
83 return a | b;
84 }
85 template <typename T>
bitwiseXor(T a,T b)86 inline T bitwiseXor(T a, T b)
87 {
88 return a ^ b;
89 }
90
91 template <typename T>
logicalNot(T a)92 inline T logicalNot(T a)
93 {
94 return !a;
95 }
96 template <typename T>
logicalAnd(T a,T b)97 inline T logicalAnd(T a, T b)
98 {
99 return a && b;
100 }
101 template <typename T>
logicalOr(T a,T b)102 inline T logicalOr(T a, T b)
103 {
104 return a || b;
105 }
106
107 template <typename T>
mod(T a,T b)108 inline T mod(T a, T b)
109 {
110 return a % b;
111 }
112 template <>
mod(float x,float y)113 inline float mod(float x, float y)
114 {
115 return x - y * deFloatFloor(x / y);
116 }
117
118 template <typename T>
negate(T f)119 inline T negate(T f)
120 {
121 return -f;
122 }
123 template <>
negate(uint32_t f)124 inline uint32_t negate<uint32_t>(uint32_t f)
125 {
126 return (uint32_t) - (int)f;
127 }
128
radians(float f)129 inline float radians(float f)
130 {
131 return deFloatRadians(f);
132 }
degrees(float f)133 inline float degrees(float f)
134 {
135 return deFloatDegrees(f);
136 }
inverseSqrt(float f)137 inline float inverseSqrt(float f)
138 {
139 return deFloatRsq(f);
140 }
sign(float f)141 inline float sign(float f)
142 {
143 return (f < 0.0f) ? -1.0f : ((f > 0.0f) ? +1.0f : 0.0f);
144 }
fract(float f)145 inline float fract(float f)
146 {
147 return f - deFloatFloor(f);
148 }
mix(float x,float y,float a)149 inline float mix(float x, float y, float a)
150 {
151 return x * (1.0f - a) + y * a;
152 }
step(float edge,float x)153 inline float step(float edge, float x)
154 {
155 return (x < edge) ? 0.0f : 1.0f;
156 }
smoothStep(float edge0,float edge1,float x)157 inline float smoothStep(float edge0, float edge1, float x)
158 {
159 if (x <= edge0)
160 return 0.0f;
161 if (x >= edge1)
162 return 1.0f;
163 float t = de::clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
164 return t * t * (3.0f - 2.0f * t);
165 }
166
mix(double x,double y,double a)167 inline double mix(double x, double y, double a)
168 {
169 return x * (1.0 - a) + y * a;
170 }
step(double edge,double x)171 inline double step(double edge, double x)
172 {
173 return (x < edge) ? 0.0 : 1.0;
174 }
175
length(float f)176 inline float length(float f)
177 {
178 return deFloatAbs(f);
179 }
distance(float x,float y)180 inline float distance(float x, float y)
181 {
182 return deFloatAbs(x - y);
183 }
dot(float x,float y)184 inline float dot(float x, float y)
185 {
186 return (x * y);
187 }
188
normalize(float f)189 inline float normalize(float f)
190 {
191 return sign(f);
192 }
faceForward(float n,float i,float ref)193 inline float faceForward(float n, float i, float ref)
194 {
195 return ((ref * i) < 0.0f) ? n : -n;
196 }
reflect(float i,float n)197 inline float reflect(float i, float n)
198 {
199 return i - 2.0f * (n * i) * n;
200 }
refract(float i,float n,float eta)201 inline float refract(float i, float n, float eta)
202 {
203 float cosAngle = (n * i);
204 float k = 1.0f - eta * eta * (1.0f - cosAngle * cosAngle);
205 if (k < 0.0f)
206 return 0.0f;
207 else
208 return eta * i - (eta * cosAngle + deFloatSqrt(k)) * n;
209 }
210
211 template <typename T>
lessThan(T a,T b)212 inline bool lessThan(T a, T b)
213 {
214 return (a < b);
215 }
216 template <typename T>
lessThanEqual(T a,T b)217 inline bool lessThanEqual(T a, T b)
218 {
219 return (a <= b);
220 }
221 template <typename T>
greaterThan(T a,T b)222 inline bool greaterThan(T a, T b)
223 {
224 return (a > b);
225 }
226 template <typename T>
greaterThanEqual(T a,T b)227 inline bool greaterThanEqual(T a, T b)
228 {
229 return (a >= b);
230 }
231 template <typename T>
equal(T a,T b)232 inline bool equal(T a, T b)
233 {
234 return (a == b);
235 }
236 template <typename T>
notEqual(T a,T b)237 inline bool notEqual(T a, T b)
238 {
239 return (a != b);
240 }
241 template <typename T>
allEqual(T a,T b)242 inline bool allEqual(T a, T b)
243 {
244 return (a == b);
245 }
246 template <typename T>
anyNotEqual(T a,T b)247 inline bool anyNotEqual(T a, T b)
248 {
249 return (a != b);
250 }
251
boolNot(bool a)252 inline bool boolNot(bool a)
253 {
254 return !a;
255 }
256
chopToInt(float a)257 inline int chopToInt(float a)
258 {
259 return deChopFloatToInt32(a);
260 }
261
roundToEven(float a)262 inline float roundToEven(float a)
263 {
264 float q = deFloatFrac(a);
265 float r = a - q;
266
267 if (q > 0.5f)
268 r += 1.0f;
269 else if (q == 0.5 && (((int)r) % 2 != 0))
270 r += 1.0f;
271
272 return r;
273 }
274
275 template <typename T, int Size>
dot(const Vector<T,Size> & a,const Vector<T,Size> & b)276 inline T dot(const Vector<T, Size> &a, const Vector<T, Size> &b)
277 {
278 T res = T();
279 for (int i = 0; i < Size; i++)
280 res += a.m_data[i] * b.m_data[i];
281 return res;
282 }
283
284 template <typename T, int Size>
lengthSquared(const Vector<T,Size> & a)285 inline T lengthSquared(const Vector<T, Size> &a)
286 {
287 T sqSum = T();
288 for (int i = 0; i < Size; i++)
289 sqSum += a.m_data[i] * a.m_data[i];
290 return sqSum;
291 }
292
293 template <typename T, int Size>
length(const Vector<T,Size> & a)294 inline typename de::meta::EnableIf<T, de::meta::TypesSame<T, double>::Value>::Type length(const Vector<T, Size> &a)
295 {
296 return ::sqrt(lengthSquared(a));
297 }
298
299 template <typename T, int Size>
length(const Vector<T,Size> & a)300 inline typename de::meta::EnableIf<T, de::meta::TypesSame<T, float>::Value>::Type length(const Vector<T, Size> &a)
301 {
302 return deFloatSqrt(lengthSquared(a));
303 }
304
305 template <typename T, int Size>
distance(const Vector<T,Size> & a,const Vector<T,Size> & b)306 inline T distance(const Vector<T, Size> &a, const Vector<T, Size> &b)
307 {
308 return length(a - b);
309 }
310
311 template <typename T, int Size>
cross(const Vector<T,Size> & a,const Vector<T,Size> & b)312 inline Vector<T, Size> cross(const Vector<T, Size> &a, const Vector<T, Size> &b)
313 {
314 DE_STATIC_ASSERT(Size == 3);
315 return Vector<T, Size>(a.y() * b.z() - b.y() * a.z(), a.z() * b.x() - b.z() * a.x(), a.x() * b.y() - b.x() * a.y());
316 }
317
318 template <typename T, int Size>
normalize(const Vector<T,Size> & a)319 inline Vector<T, Size> normalize(const Vector<T, Size> &a)
320 {
321 T ooLen = T(1) / length(a);
322 Vector<T, Size> res;
323 for (int i = 0; i < Size; i++)
324 res.m_data[i] = ooLen * a.m_data[i];
325 return res;
326 }
327
328 template <typename T, int Size>
faceForward(const Vector<T,Size> & n,const Vector<T,Size> & i,const Vector<T,Size> & ref)329 inline Vector<T, Size> faceForward(const Vector<T, Size> &n, const Vector<T, Size> &i, const Vector<T, Size> &ref)
330 {
331 return (dot(ref, i) < T(0)) ? n : -n;
332 }
333
334 template <typename T, int Size>
reflect(const Vector<T,Size> & i,const Vector<T,Size> & n)335 inline Vector<T, Size> reflect(const Vector<T, Size> &i, const Vector<T, Size> &n)
336 {
337 return i - T(2) * dot(n, i) * n;
338 }
339
340 template <typename T, int Size>
refract(const Vector<T,Size> & i,const Vector<T,Size> & n,T eta)341 inline Vector<T, Size> refract(const Vector<T, Size> &i, const Vector<T, Size> &n, T eta)
342 {
343 T cosAngle = dot(n, i);
344 T k = T(1) - eta * eta * (T(1) - cosAngle * cosAngle);
345 if (k < T(0))
346 return Vector<T, Size>(T(0));
347 else
348 return i * eta - n * T(eta * cosAngle + ::sqrt(k));
349 }
350
351 template <int Size>
mix(const Vector<float,Size> & x,const Vector<float,Size> & y,float a)352 Vector<float, Size> mix(const Vector<float, Size> &x, const Vector<float, Size> &y, float a)
353 {
354 Vector<float, Size> res;
355 for (int i = 0; i < Size; i++)
356 res.m_data[i] = deFloatMix(x.m_data[i], y.m_data[i], a);
357 return res;
358 }
359
360 template <int Size>
mix(const Vector<double,Size> & x,const Vector<double,Size> & y,double a)361 Vector<double, Size> mix(const Vector<double, Size> &x, const Vector<double, Size> &y, double a)
362 {
363 Vector<double, Size> res;
364 for (int i = 0; i < Size; i++)
365 res.m_data[i] = deMix(x.m_data[i], y.m_data[i], a);
366 return res;
367 }
368
369 // Piece-wise compare operators.
370
371 template <typename T, int Size>
equal(const Vector<T,Size> & a,const Vector<T,Size> & b)372 inline Vector<bool, Size> equal(const Vector<T, Size> &a, const Vector<T, Size> &b)
373 {
374 Vector<bool, Size> res;
375 for (int i = 0; i < Size; i++)
376 res.m_data[i] = a.m_data[i] == b.m_data[i];
377 return res;
378 }
379
380 template <typename T, int Size>
notEqual(const Vector<T,Size> & a,const Vector<T,Size> & b)381 inline Vector<bool, Size> notEqual(const Vector<T, Size> &a, const Vector<T, Size> &b)
382 {
383 Vector<bool, Size> res;
384 for (int i = 0; i < Size; i++)
385 res.m_data[i] = a.m_data[i] != b.m_data[i];
386 return res;
387 }
388
389 template <typename T, int Size>
lessThan(const Vector<T,Size> & a,const Vector<T,Size> & b)390 inline Vector<bool, Size> lessThan(const Vector<T, Size> &a, const Vector<T, Size> &b)
391 {
392 Vector<bool, Size> res;
393 for (int i = 0; i < Size; i++)
394 res.m_data[i] = a.m_data[i] < b.m_data[i];
395 return res;
396 }
397
398 template <typename T, int Size>
lessThanEqual(const Vector<T,Size> & a,const Vector<T,Size> & b)399 inline Vector<bool, Size> lessThanEqual(const Vector<T, Size> &a, const Vector<T, Size> &b)
400 {
401 Vector<bool, Size> res;
402 for (int i = 0; i < Size; i++)
403 res.m_data[i] = a.m_data[i] <= b.m_data[i];
404 return res;
405 }
406
407 template <typename T, int Size>
greaterThan(const Vector<T,Size> & a,const Vector<T,Size> & b)408 inline Vector<bool, Size> greaterThan(const Vector<T, Size> &a, const Vector<T, Size> &b)
409 {
410 Vector<bool, Size> res;
411 for (int i = 0; i < Size; i++)
412 res.m_data[i] = a.m_data[i] > b.m_data[i];
413 return res;
414 }
415
416 template <typename T, int Size>
greaterThanEqual(const Vector<T,Size> & a,const Vector<T,Size> & b)417 inline Vector<bool, Size> greaterThanEqual(const Vector<T, Size> &a, const Vector<T, Size> &b)
418 {
419 Vector<bool, Size> res;
420 for (int i = 0; i < Size; i++)
421 res.m_data[i] = a.m_data[i] >= b.m_data[i];
422 return res;
423 }
424
425 // Equality comparison operators.
426
427 template <typename T, int Size>
allEqual(const Vector<T,Size> & a,const Vector<T,Size> & b)428 inline bool allEqual(const Vector<T, Size> &a, const Vector<T, Size> &b)
429 {
430 bool res = true;
431 for (int i = 0; i < Size; i++)
432 res = res && a.m_data[i] == b.m_data[i];
433 return res;
434 }
435
436 template <typename T, int Size>
anyNotEqual(const Vector<T,Size> & a,const Vector<T,Size> & b)437 inline bool anyNotEqual(const Vector<T, Size> &a, const Vector<T, Size> &b)
438 {
439 bool res = false;
440 for (int i = 0; i < Size; i++)
441 res = res || a.m_data[i] != b.m_data[i];
442 return res;
443 }
444
445 // Boolean built-ins.
446
447 template <int Size>
boolNot(const Vector<bool,Size> & a)448 inline Vector<bool, Size> boolNot(const Vector<bool, Size> &a)
449 {
450 Vector<bool, Size> res;
451 for (int i = 0; i < Size; i++)
452 res.m_data[i] = !a.m_data[i];
453 return res;
454 }
455
456 template <int Size>
boolAny(const Vector<bool,Size> & a)457 inline bool boolAny(const Vector<bool, Size> &a)
458 {
459 for (int i = 0; i < Size; i++)
460 if (a.m_data[i] == true)
461 return true;
462 return false;
463 }
464
465 template <int Size>
boolAll(const Vector<bool,Size> & a)466 inline bool boolAll(const Vector<bool, Size> &a)
467 {
468 for (int i = 0; i < Size; i++)
469 if (a.m_data[i] == false)
470 return false;
471 return true;
472 }
473
474 template <int Size>
chopToInt(const Vector<float,Size> & v)475 Vector<int, Size> chopToInt(const Vector<float, Size> &v)
476 {
477 Vector<int, Size> res;
478 for (int i = 0; i < Size; i++)
479 res.m_data[i] = chopToInt(v.m_data[i]);
480 return res;
481 }
482
483 // Vector construction using selection based on boolean vector.
484
485 template <typename T, int Size>
select(T trueVal,T falseVal,const Vector<bool,Size> & cond)486 inline Vector<T, Size> select(T trueVal, T falseVal, const Vector<bool, Size> &cond)
487 {
488 Vector<T, Size> res;
489 for (int i = 0; i < Size; i++)
490 res[i] = cond[i] ? trueVal : falseVal;
491 return res;
492 }
493
494 // Component-wise selection.
495
496 template <typename T, int Size>
select(const Vector<T,Size> & trueVal,const Vector<T,Size> & falseVal,const Vector<bool,Size> & cond)497 inline Vector<T, Size> select(const Vector<T, Size> &trueVal, const Vector<T, Size> &falseVal,
498 const Vector<bool, Size> &cond)
499 {
500 Vector<T, Size> res;
501 for (int i = 0; i < Size; i++)
502 res[i] = cond[i] ? trueVal[i] : falseVal[i];
503 return res;
504 }
505
506 // Absolute difference (abs(a - b))
507
508 template <typename T, int Size>
absDiff(const Vector<T,Size> & a,const Vector<T,Size> & b)509 static inline Vector<T, Size> absDiff(const Vector<T, Size> &a, const Vector<T, Size> &b)
510 {
511 Vector<T, Size> res;
512
513 for (int ndx = 0; ndx < Size; ndx++)
514 res[ndx] = (a[ndx] > b[ndx]) ? (a[ndx] - b[ndx]) : (b[ndx] - a[ndx]);
515
516 return res;
517 }
518
519 template <typename T, int Size>
randomVector(de::Random & rnd,const tcu::Vector<T,Size> & minValue,const tcu::Vector<T,Size> & maxValue)520 inline tcu::Vector<T, Size> randomVector(de::Random &rnd, const tcu::Vector<T, Size> &minValue,
521 const tcu::Vector<T, Size> &maxValue)
522 {
523 tcu::Vector<T, Size> res;
524
525 for (int ndx = 0; ndx < Size; ndx++)
526 res[ndx] = de::randomScalar<T>(rnd, minValue[ndx], maxValue[ndx]);
527
528 return res;
529 }
530
randomVec2(de::Random & rnd)531 inline Vector<float, 2> randomVec2(de::Random &rnd)
532 {
533 return randomVector<float, 2>(rnd, tcu::Vector<float, 2>(0.0f), tcu::Vector<float, 2>(1.0f));
534 }
535
randomVec3(de::Random & rnd)536 inline Vector<float, 3> randomVec3(de::Random &rnd)
537 {
538 return randomVector<float, 3>(rnd, tcu::Vector<float, 3>(0.0f), tcu::Vector<float, 3>(1.0f));
539 }
540
randomVec4(de::Random & rnd)541 inline Vector<float, 4> randomVec4(de::Random &rnd)
542 {
543 return randomVector<float, 4>(rnd, tcu::Vector<float, 4>(0.0f), tcu::Vector<float, 4>(1.0f));
544 }
545
546 // Macros for component-wise ops.
547
548 #define TCU_DECLARE_VECTOR_UNARY_FUNC(FUNC_NAME, OP_NAME) \
549 template <typename T, int Size> \
550 Vector<T, Size> FUNC_NAME(const Vector<T, Size> &v) \
551 { \
552 Vector<T, Size> res; \
553 for (int i = 0; i < Size; i++) \
554 res.m_data[i] = OP_NAME(v.m_data[i]); \
555 return res; \
556 }
557
558 #define TCU_DECLARE_VECTOR_BINARY_FUNC(FUNC_NAME, OP_NAME) \
559 template <typename T, int Size> \
560 Vector<T, Size> FUNC_NAME(const Vector<T, Size> &a, const Vector<T, Size> &b) \
561 { \
562 Vector<T, Size> res; \
563 for (int i = 0; i < Size; i++) \
564 res.m_data[i] = OP_NAME(a.m_data[i], b.m_data[i]); \
565 return res; \
566 }
567
568 #define TCU_DECLARE_VECTOR_TERNARY_FUNC(FUNC_NAME, OP_NAME) \
569 template <typename T, int Size> \
570 Vector<T, Size> FUNC_NAME(const Vector<T, Size> &a, const Vector<T, Size> &b, const Vector<T, Size> &c) \
571 { \
572 Vector<T, Size> res; \
573 for (int i = 0; i < Size; i++) \
574 res.m_data[i] = OP_NAME(a.m_data[i], b.m_data[i], c.m_data[i]); \
575 return res; \
576 }
577
578 // \todo [2011-07-01 pyry] Add some prefix to vector funcs and remove this hack.
579 #if defined(min)
580 #undef min
581 #endif
582 #if defined(max)
583 #undef max
584 #endif
585
586 TCU_DECLARE_VECTOR_UNARY_FUNC(negate, negate)
587 TCU_DECLARE_VECTOR_UNARY_FUNC(bitwiseNot, bitwiseNot)
588 TCU_DECLARE_VECTOR_BINARY_FUNC(add, add)
589 TCU_DECLARE_VECTOR_BINARY_FUNC(sub, sub)
590 TCU_DECLARE_VECTOR_BINARY_FUNC(mul, mul)
591 TCU_DECLARE_VECTOR_BINARY_FUNC(div, div)
592 TCU_DECLARE_VECTOR_BINARY_FUNC(mod, mod)
593 TCU_DECLARE_VECTOR_BINARY_FUNC(bitwiseAnd, bitwiseAnd)
594 TCU_DECLARE_VECTOR_BINARY_FUNC(bitwiseOr, bitwiseOr)
595 TCU_DECLARE_VECTOR_BINARY_FUNC(bitwiseXor, bitwiseXor)
596 TCU_DECLARE_VECTOR_UNARY_FUNC(logicalNot, logicalNot)
597 TCU_DECLARE_VECTOR_BINARY_FUNC(logicalAnd, logicalAnd)
598 TCU_DECLARE_VECTOR_BINARY_FUNC(logicalOr, logicalOr)
599
600 TCU_DECLARE_VECTOR_UNARY_FUNC(radians, deFloatRadians)
601 TCU_DECLARE_VECTOR_UNARY_FUNC(degrees, deFloatDegrees)
602 TCU_DECLARE_VECTOR_UNARY_FUNC(sin, deFloatSin)
603 TCU_DECLARE_VECTOR_UNARY_FUNC(cos, deFloatCos)
604 TCU_DECLARE_VECTOR_UNARY_FUNC(tan, deFloatTan)
605 TCU_DECLARE_VECTOR_UNARY_FUNC(asin, deFloatAsin)
606 TCU_DECLARE_VECTOR_UNARY_FUNC(acos, deFloatAcos)
607 TCU_DECLARE_VECTOR_UNARY_FUNC(atan, deFloatAtanOver)
608 TCU_DECLARE_VECTOR_BINARY_FUNC(atan2, deFloatAtan2)
609 TCU_DECLARE_VECTOR_UNARY_FUNC(sinh, deFloatSinh)
610 TCU_DECLARE_VECTOR_UNARY_FUNC(cosh, deFloatCosh)
611 TCU_DECLARE_VECTOR_UNARY_FUNC(tanh, deFloatTanh)
612 TCU_DECLARE_VECTOR_UNARY_FUNC(asinh, deFloatAsinh)
613 TCU_DECLARE_VECTOR_UNARY_FUNC(acosh, deFloatAcosh)
614 TCU_DECLARE_VECTOR_UNARY_FUNC(atanh, deFloatAtanh)
615
616 TCU_DECLARE_VECTOR_BINARY_FUNC(pow, deFloatPow)
617 TCU_DECLARE_VECTOR_UNARY_FUNC(exp, deFloatExp)
618 TCU_DECLARE_VECTOR_UNARY_FUNC(log, deFloatLog)
619 TCU_DECLARE_VECTOR_UNARY_FUNC(exp2, deFloatExp2)
620 TCU_DECLARE_VECTOR_UNARY_FUNC(log2, deFloatLog2)
621 TCU_DECLARE_VECTOR_UNARY_FUNC(sqrt, deFloatSqrt)
622 TCU_DECLARE_VECTOR_UNARY_FUNC(inverseSqrt, deFloatRsq)
623
624 TCU_DECLARE_VECTOR_UNARY_FUNC(abs, de::abs)
625 TCU_DECLARE_VECTOR_UNARY_FUNC(sign, deFloatSign)
626 TCU_DECLARE_VECTOR_UNARY_FUNC(floor, deFloatFloor)
627 TCU_DECLARE_VECTOR_UNARY_FUNC(trunc, deFloatTrunc)
628 TCU_DECLARE_VECTOR_UNARY_FUNC(roundToEven, roundToEven)
629 TCU_DECLARE_VECTOR_UNARY_FUNC(ceil, deFloatCeil)
630 TCU_DECLARE_VECTOR_UNARY_FUNC(fract, deFloatFrac)
631 TCU_DECLARE_VECTOR_BINARY_FUNC(min, de::min)
632 TCU_DECLARE_VECTOR_BINARY_FUNC(max, de::max)
633 TCU_DECLARE_VECTOR_TERNARY_FUNC(clamp, de::clamp)
634 TCU_DECLARE_VECTOR_TERNARY_FUNC(mix, deFloatMix)
635 TCU_DECLARE_VECTOR_BINARY_FUNC(step, deFloatStep)
636 TCU_DECLARE_VECTOR_TERNARY_FUNC(smoothStep, deFloatSmoothStep)
637
638 } // namespace tcu
639
640 #endif // _TCUVECTORUTIL_HPP
641