Blender  V2.93
util_math_float4.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2017 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __UTIL_MATH_FLOAT4_H__
18 #define __UTIL_MATH_FLOAT4_H__
19 
20 #ifndef __UTIL_MATH_H__
21 # error "Do not include this file directly, include util_types.h instead."
22 #endif
23 
25 
26 /*******************************************************************************
27  * Declaration.
28  */
29 
30 #ifndef __KERNEL_OPENCL__
31 ccl_device_inline float4 operator-(const float4 &a);
32 ccl_device_inline float4 operator*(const float4 &a, const float4 &b);
33 ccl_device_inline float4 operator*(const float4 &a, float f);
34 ccl_device_inline float4 operator*(float f, const float4 &a);
35 ccl_device_inline float4 operator/(const float4 &a, float f);
36 ccl_device_inline float4 operator/(const float4 &a, const float4 &b);
37 ccl_device_inline float4 operator+(const float4 &a, const float f);
38 ccl_device_inline float4 operator+(const float4 &a, const float4 &b);
39 ccl_device_inline float4 operator-(const float4 &a, const float f);
40 ccl_device_inline float4 operator-(const float4 &a, const float4 &b);
41 ccl_device_inline float4 operator+=(float4 &a, const float4 &b);
42 ccl_device_inline float4 operator*=(float4 &a, const float4 &b);
43 ccl_device_inline float4 operator*=(float4 &a, float f);
44 ccl_device_inline float4 operator/=(float4 &a, float f);
45 
46 ccl_device_inline int4 operator<(const float4 &a, const float4 &b);
47 ccl_device_inline int4 operator>=(const float4 &a, const float4 &b);
48 ccl_device_inline int4 operator<=(const float4 &a, const float4 &b);
49 ccl_device_inline bool operator==(const float4 &a, const float4 &b);
50 
51 ccl_device_inline float distance(const float4 &a, const float4 &b);
52 ccl_device_inline float dot(const float4 &a, const float4 &b);
53 ccl_device_inline float len_squared(const float4 &a);
54 ccl_device_inline float4 rcp(const float4 &a);
55 ccl_device_inline float4 sqrt(const float4 &a);
56 ccl_device_inline float4 sqr(const float4 &a);
57 ccl_device_inline float4 cross(const float4 &a, const float4 &b);
58 ccl_device_inline bool is_zero(const float4 &a);
59 ccl_device_inline float average(const float4 &a);
60 ccl_device_inline float len(const float4 &a);
61 ccl_device_inline float4 normalize(const float4 &a);
62 ccl_device_inline float4 safe_normalize(const float4 &a);
63 ccl_device_inline float4 min(const float4 &a, const float4 &b);
64 ccl_device_inline float4 max(const float4 &a, const float4 &b);
65 ccl_device_inline float4 clamp(const float4 &a, const float4 &mn, const float4 &mx);
66 ccl_device_inline float4 fabs(const float4 &a);
67 ccl_device_inline float4 floor(const float4 &a);
68 ccl_device_inline float4 mix(const float4 &a, const float4 &b, float t);
69 #endif /* !__KERNEL_OPENCL__*/
70 
71 ccl_device_inline float4 safe_divide_float4_float(const float4 a, const float b);
72 
73 #ifdef __KERNEL_SSE__
74 template<size_t index_0, size_t index_1, size_t index_2, size_t index_3>
75 __forceinline const float4 shuffle(const float4 &b);
76 template<size_t index_0, size_t index_1, size_t index_2, size_t index_3>
77 __forceinline const float4 shuffle(const float4 &a, const float4 &b);
78 
79 template<> __forceinline const float4 shuffle<0, 1, 0, 1>(const float4 &b);
80 
81 template<> __forceinline const float4 shuffle<0, 1, 0, 1>(const float4 &a, const float4 &b);
82 template<> __forceinline const float4 shuffle<2, 3, 2, 3>(const float4 &a, const float4 &b);
83 
84 # ifdef __KERNEL_SSE3__
85 template<> __forceinline const float4 shuffle<0, 0, 2, 2>(const float4 &b);
86 template<> __forceinline const float4 shuffle<1, 1, 3, 3>(const float4 &b);
87 # endif
88 #endif /* __KERNEL_SSE__ */
89 
90 #ifndef __KERNEL_GPU__
91 ccl_device_inline float4 select(const int4 &mask, const float4 &a, const float4 &b);
92 ccl_device_inline float4 reduce_min(const float4 &a);
93 ccl_device_inline float4 reduce_max(const float4 &a);
94 ccl_device_inline float4 reduce_add(const float4 &a);
95 #endif /* !__KERNEL_GPU__ */
96 
97 /*******************************************************************************
98  * Definition.
99  */
100 
102 {
103 #ifdef __KERNEL_SSE__
104  return float4(_mm_setzero_ps());
105 #else
106  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
107 #endif
108 }
109 
111 {
112  return make_float4(1.0f, 1.0f, 1.0f, 1.0f);
113 }
114 
115 #ifndef __KERNEL_OPENCL__
116 ccl_device_inline float4 operator-(const float4 &a)
117 {
118 # ifdef __KERNEL_SSE__
119  __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
120  return float4(_mm_xor_ps(a.m128, mask));
121 # else
122  return make_float4(-a.x, -a.y, -a.z, -a.w);
123 # endif
124 }
125 
126 ccl_device_inline float4 operator*(const float4 &a, const float4 &b)
127 {
128 # ifdef __KERNEL_SSE__
129  return float4(_mm_mul_ps(a.m128, b.m128));
130 # else
131  return make_float4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
132 # endif
133 }
134 
135 ccl_device_inline float4 operator*(const float4 &a, float f)
136 {
137 # if defined(__KERNEL_SSE__)
138  return a * make_float4(f);
139 # else
140  return make_float4(a.x * f, a.y * f, a.z * f, a.w * f);
141 # endif
142 }
143 
144 ccl_device_inline float4 operator*(float f, const float4 &a)
145 {
146  return a * f;
147 }
148 
149 ccl_device_inline float4 operator/(const float4 &a, float f)
150 {
151  return a * (1.0f / f);
152 }
153 
154 ccl_device_inline float4 operator/(const float4 &a, const float4 &b)
155 {
156 # ifdef __KERNEL_SSE__
157  return float4(_mm_div_ps(a.m128, b.m128));
158 # else
159  return make_float4(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w);
160 # endif
161 }
162 
163 ccl_device_inline float4 operator+(const float4 &a, const float f)
164 {
165  return a + make_float4(f, f, f, f);
166 }
167 
168 ccl_device_inline float4 operator+(const float4 &a, const float4 &b)
169 {
170 # ifdef __KERNEL_SSE__
171  return float4(_mm_add_ps(a.m128, b.m128));
172 # else
173  return make_float4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w);
174 # endif
175 }
176 
177 ccl_device_inline float4 operator-(const float4 &a, const float f)
178 {
179  return a - make_float4(f, f, f, f);
180 }
181 
182 ccl_device_inline float4 operator-(const float4 &a, const float4 &b)
183 {
184 # ifdef __KERNEL_SSE__
185  return float4(_mm_sub_ps(a.m128, b.m128));
186 # else
187  return make_float4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w);
188 # endif
189 }
190 
191 ccl_device_inline float4 operator+=(float4 &a, const float4 &b)
192 {
193  return a = a + b;
194 }
195 
196 ccl_device_inline float4 operator-=(float4 &a, const float4 &b)
197 {
198  return a = a - b;
199 }
200 
201 ccl_device_inline float4 operator*=(float4 &a, const float4 &b)
202 {
203  return a = a * b;
204 }
205 
206 ccl_device_inline float4 operator*=(float4 &a, float f)
207 {
208  return a = a * f;
209 }
210 
211 ccl_device_inline float4 operator/=(float4 &a, float f)
212 {
213  return a = a / f;
214 }
215 
216 ccl_device_inline int4 operator<(const float4 &a, const float4 &b)
217 {
218 # ifdef __KERNEL_SSE__
219  return int4(_mm_castps_si128(_mm_cmplt_ps(a.m128, b.m128)));
220 # else
221  return make_int4(a.x < b.x, a.y < b.y, a.z < b.z, a.w < b.w);
222 # endif
223 }
224 
225 ccl_device_inline int4 operator>=(const float4 &a, const float4 &b)
226 {
227 # ifdef __KERNEL_SSE__
228  return int4(_mm_castps_si128(_mm_cmpge_ps(a.m128, b.m128)));
229 # else
230  return make_int4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w);
231 # endif
232 }
233 
234 ccl_device_inline int4 operator<=(const float4 &a, const float4 &b)
235 {
236 # ifdef __KERNEL_SSE__
237  return int4(_mm_castps_si128(_mm_cmple_ps(a.m128, b.m128)));
238 # else
239  return make_int4(a.x <= b.x, a.y <= b.y, a.z <= b.z, a.w <= b.w);
240 # endif
241 }
242 
243 ccl_device_inline bool operator==(const float4 &a, const float4 &b)
244 {
245 # ifdef __KERNEL_SSE__
246  return (_mm_movemask_ps(_mm_cmpeq_ps(a.m128, b.m128)) & 15) == 15;
247 # else
248  return (a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w);
249 # endif
250 }
251 
252 ccl_device_inline float distance(const float4 &a, const float4 &b)
253 {
254  return len(a - b);
255 }
256 
257 ccl_device_inline float dot(const float4 &a, const float4 &b)
258 {
259 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
260 # if defined(__KERNEL_NEON__)
261  __m128 t = vmulq_f32(a, b);
262  return vaddvq_f32(t);
263 # else
264  return _mm_cvtss_f32(_mm_dp_ps(a, b, 0xFF));
265 # endif
266 # else
267  return (a.x * b.x + a.y * b.y) + (a.z * b.z + a.w * b.w);
268 # endif
269 }
270 
271 ccl_device_inline float len_squared(const float4 &a)
272 {
273  return dot(a, a);
274 }
275 
276 ccl_device_inline float4 rcp(const float4 &a)
277 {
278 # ifdef __KERNEL_SSE__
279  /* Don't use _mm_rcp_ps due to poor precision. */
280  return float4(_mm_div_ps(_mm_set_ps1(1.0f), a.m128));
281 # else
282  return make_float4(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w);
283 # endif
284 }
285 
286 ccl_device_inline float4 sqrt(const float4 &a)
287 {
288 # ifdef __KERNEL_SSE__
289  return float4(_mm_sqrt_ps(a.m128));
290 # else
291  return make_float4(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z), sqrtf(a.w));
292 # endif
293 }
294 
295 ccl_device_inline float4 sqr(const float4 &a)
296 {
297  return a * a;
298 }
299 
300 ccl_device_inline float4 cross(const float4 &a, const float4 &b)
301 {
302 # ifdef __KERNEL_SSE__
303  return (shuffle<1, 2, 0, 0>(a) * shuffle<2, 0, 1, 0>(b)) -
304  (shuffle<2, 0, 1, 0>(a) * shuffle<1, 2, 0, 0>(b));
305 # else
306  return make_float4(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x, 0.0f);
307 # endif
308 }
309 
310 ccl_device_inline bool is_zero(const float4 &a)
311 {
312 # ifdef __KERNEL_SSE__
313  return a == make_float4(0.0f);
314 # else
315  return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f && a.w == 0.0f);
316 # endif
317 }
318 
319 ccl_device_inline float4 reduce_add(const float4 &a)
320 {
321 # if defined(__KERNEL_SSE__)
322 # if defined(__KERNEL_NEON__)
323  return float4(vdupq_n_f32(vaddvq_f32(a)));
324 # elif defined(__KERNEL_SSE3__)
325  float4 h(_mm_hadd_ps(a.m128, a.m128));
326  return float4(_mm_hadd_ps(h.m128, h.m128));
327 # else
328  float4 h(shuffle<1, 0, 3, 2>(a) + a);
329  return shuffle<2, 3, 0, 1>(h) + h;
330 # endif
331 # else
332  float sum = (a.x + a.y) + (a.z + a.w);
333  return make_float4(sum, sum, sum, sum);
334 # endif
335 }
336 
337 ccl_device_inline float average(const float4 &a)
338 {
339  return reduce_add(a).x * 0.25f;
340 }
341 
342 ccl_device_inline float len(const float4 &a)
343 {
344  return sqrtf(dot(a, a));
345 }
346 
347 ccl_device_inline float4 normalize(const float4 &a)
348 {
349  return a / len(a);
350 }
351 
352 ccl_device_inline float4 safe_normalize(const float4 &a)
353 {
354  float t = len(a);
355  return (t != 0.0f) ? a / t : a;
356 }
357 
358 ccl_device_inline float4 min(const float4 &a, const float4 &b)
359 {
360 # ifdef __KERNEL_SSE__
361  return float4(_mm_min_ps(a.m128, b.m128));
362 # else
363  return make_float4(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z), min(a.w, b.w));
364 # endif
365 }
366 
367 ccl_device_inline float4 max(const float4 &a, const float4 &b)
368 {
369 # ifdef __KERNEL_SSE__
370  return float4(_mm_max_ps(a.m128, b.m128));
371 # else
372  return make_float4(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z), max(a.w, b.w));
373 # endif
374 }
375 
376 ccl_device_inline float4 clamp(const float4 &a, const float4 &mn, const float4 &mx)
377 {
378  return min(max(a, mn), mx);
379 }
380 
381 ccl_device_inline float4 fabs(const float4 &a)
382 {
383 # if defined(__KERNEL_SSE__)
384 # if defined(__KERNEL_NEON__)
385  return float4(vabsq_f32(a));
386 # else
387  return float4(_mm_and_ps(a.m128, _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff))));
388 # endif
389 # else
390  return make_float4(fabsf(a.x), fabsf(a.y), fabsf(a.z), fabsf(a.w));
391 # endif
392 }
393 
394 ccl_device_inline float4 floor(const float4 &a)
395 {
396 # ifdef __KERNEL_SSE__
397  return float4(_mm_floor_ps(a));
398 # else
399  return make_float4(floorf(a.x), floorf(a.y), floorf(a.z), floorf(a.w));
400 # endif
401 }
402 
403 ccl_device_inline float4 mix(const float4 &a, const float4 &b, float t)
404 {
405  return a + t * (b - a);
406 }
407 
408 #endif /* !__KERNEL_OPENCL__*/
409 
410 #ifdef __KERNEL_SSE__
411 template<size_t index_0, size_t index_1, size_t index_2, size_t index_3>
412 __forceinline const float4 shuffle(const float4 &b)
413 {
414 # if defined(__KERNEL_NEON__)
415  return float4(shuffle_neon<__m128, index_0, index_1, index_2, index_3>(b.m128));
416 # else
417  return float4(_mm_castsi128_ps(
418  _mm_shuffle_epi32(_mm_castps_si128(b), _MM_SHUFFLE(index_3, index_2, index_1, index_0))));
419 # endif
420 }
421 
422 template<size_t index_0, size_t index_1, size_t index_2, size_t index_3>
423 __forceinline const float4 shuffle(const float4 &a, const float4 &b)
424 {
425 # if defined(__KERNEL_NEON__)
426  return float4(shuffle_neon<__m128, index_0, index_1, index_2, index_3>(a.m128, b.m128));
427 # else
428  return float4(_mm_shuffle_ps(a.m128, b.m128, _MM_SHUFFLE(index_3, index_2, index_1, index_0)));
429 # endif
430 }
431 
432 template<> __forceinline const float4 shuffle<0, 1, 0, 1>(const float4 &b)
433 {
434  return float4(_mm_castpd_ps(_mm_movedup_pd(_mm_castps_pd(b))));
435 }
436 
437 template<> __forceinline const float4 shuffle<0, 1, 0, 1>(const float4 &a, const float4 &b)
438 {
439  return float4(_mm_movelh_ps(a.m128, b.m128));
440 }
441 
442 template<> __forceinline const float4 shuffle<2, 3, 2, 3>(const float4 &a, const float4 &b)
443 {
444  return float4(_mm_movehl_ps(b.m128, a.m128));
445 }
446 
447 # ifdef __KERNEL_SSE3__
448 template<> __forceinline const float4 shuffle<0, 0, 2, 2>(const float4 &b)
449 {
450  return float4(_mm_moveldup_ps(b));
451 }
452 
453 template<> __forceinline const float4 shuffle<1, 1, 3, 3>(const float4 &b)
454 {
455  return float4(_mm_movehdup_ps(b));
456 }
457 # endif /* __KERNEL_SSE3__ */
458 #endif /* __KERNEL_SSE__ */
459 
460 #ifndef __KERNEL_GPU__
461 ccl_device_inline float4 select(const int4 &mask, const float4 &a, const float4 &b)
462 {
463 # ifdef __KERNEL_SSE__
464  return float4(_mm_blendv_ps(b.m128, a.m128, _mm_castsi128_ps(mask.m128)));
465 # else
466  return make_float4(
467  (mask.x) ? a.x : b.x, (mask.y) ? a.y : b.y, (mask.z) ? a.z : b.z, (mask.w) ? a.w : b.w);
468 # endif
469 }
470 
471 ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
472 {
473  /* Replace elements of x with zero where mask isn't set. */
474  return select(mask, a, make_float4(0.0f));
475 }
476 
477 ccl_device_inline float4 reduce_min(const float4 &a)
478 {
479 # if defined(__KERNEL_SSE__)
480 # if defined(__KERNEL_NEON__)
481  return float4(vdupq_n_f32(vminvq_f32(a)));
482 # else
483  float4 h = min(shuffle<1, 0, 3, 2>(a), a);
484  return min(shuffle<2, 3, 0, 1>(h), h);
485 # endif
486 # else
487  return make_float4(min(min(a.x, a.y), min(a.z, a.w)));
488 # endif
489 }
490 
491 ccl_device_inline float4 reduce_max(const float4 &a)
492 {
493 # if defined(__KERNEL_SSE__)
494 # if defined(__KERNEL_NEON__)
495  return float4(vdupq_n_f32(vmaxvq_f32(a)));
496 # else
497  float4 h = max(shuffle<1, 0, 3, 2>(a), a);
498  return max(shuffle<2, 3, 0, 1>(h), h);
499 # endif
500 # else
501  return make_float4(max(max(a.x, a.y), max(a.z, a.w)));
502 # endif
503 }
504 
505 ccl_device_inline float4 load_float4(const float *v)
506 {
507 # ifdef __KERNEL_SSE__
508  return float4(_mm_loadu_ps(v));
509 # else
510  return make_float4(v[0], v[1], v[2], v[3]);
511 # endif
512 }
513 
514 #endif /* !__KERNEL_GPU__ */
515 
516 ccl_device_inline float4 safe_divide_float4_float(const float4 a, const float b)
517 {
518  return (b != 0.0f) ? a / b : zero_float4();
519 }
520 
522 {
523  return isfinite_safe(v.x) && isfinite_safe(v.y) && isfinite_safe(v.z) && isfinite_safe(v.w);
524 }
525 
527 {
528  if (!isfinite_safe(v.x))
529  v.x = 0.0f;
530  if (!isfinite_safe(v.y))
531  v.y = 0.0f;
532  if (!isfinite_safe(v.z))
533  v.z = 0.0f;
534  if (!isfinite_safe(v.w))
535  v.w = 0.0f;
536  return v;
537 }
538 
540 
541 #endif /* __UTIL_MATH_FLOAT4_H__ */
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
ATTR_WARN_UNUSED_RESULT const BMVert * v
static T sum(const btAlignedObjectArray< T > &items)
static void shuffle(float2 points[], int size, int rng_seed)
Definition: jitter.cpp:243
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define make_int4(x, y, z, w)
#define floorf(x)
#define make_float4(x, y, z, w)
#define fabsf(x)
#define sqrtf(x)
static unsigned a[3]
Definition: RandGen.cpp:92
__forceinline const avxi shuffle< 0, 0, 2, 2 >(const avxi &b)
Definition: util_avxi.h:625
__forceinline const avxi shuffle< 0, 1, 0, 1 >(const avxi &b)
Definition: util_avxi.h:633
__forceinline const avxi shuffle< 1, 1, 3, 3 >(const avxi &b)
Definition: util_avxi.h:629
#define __forceinline
Definition: util_defines.h:71
ccl_device_inline bool isfinite_safe(float f)
Definition: util_math.h:270
ccl_device_inline float len_squared(const float4 &a)
ccl_device_inline float4 reduce_min(const float4 &a)
ccl_device_inline float4 reduce_max(const float4 &a)
ccl_device_inline float4 operator+=(float4 &a, const float4 &b)
ccl_device_inline bool operator==(const float4 &a, const float4 &b)
ccl_device_inline float4 safe_normalize(const float4 &a)
ccl_device_inline float4 normalize(const float4 &a)
ccl_device_inline float4 one_float4()
ccl_device_inline int4 operator<(const float4 &a, const float4 &b)
ccl_device_inline float4 rcp(const float4 &a)
ccl_device_inline bool isfinite4_safe(float4 v)
ccl_device_inline float4 operator+(const float4 &a, const float f)
CCL_NAMESPACE_BEGIN ccl_device_inline float4 operator-(const float4 &a)
ccl_device_inline int4 operator>=(const float4 &a, const float4 &b)
ccl_device_inline int4 operator<=(const float4 &a, const float4 &b)
ccl_device_inline float4 zero_float4()
ccl_device_inline float distance(const float4 &a, const float4 &b)
ccl_device_inline float4 floor(const float4 &a)
ccl_device_inline float len(const float4 &a)
ccl_device_inline float4 operator*(const float4 &a, const float4 &b)
ccl_device_inline float4 sqrt(const float4 &a)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
ccl_device_inline float4 sqr(const float4 &a)
ccl_device_inline float4 fabs(const float4 &a)
ccl_device_inline float average(const float4 &a)
ccl_device_inline float4 reduce_add(const float4 &a)
ccl_device_inline float4 mix(const float4 &a, const float4 &b, float t)
ccl_device_inline float4 min(const float4 &a, const float4 &b)
ccl_device_inline float dot(const float4 &a, const float4 &b)
ccl_device_inline bool is_zero(const float4 &a)
ccl_device_inline float4 select(const int4 &mask, const float4 &a, const float4 &b)
ccl_device_inline float4 safe_divide_float4_float(const float4 a, const float b)
ccl_device_inline float4 operator*=(float4 &a, const float4 &b)
ccl_device_inline float4 operator-=(float4 &a, const float4 &b)
ccl_device_inline float4 ensure_finite4(float4 v)
ccl_device_inline float4 cross(const float4 &a, const float4 &b)
ccl_device_inline float4 clamp(const float4 &a, const float4 &mn, const float4 &mx)
ccl_device_inline float4 load_float4(const float *v)
ccl_device_inline float4 max(const float4 &a, const float4 &b)
ccl_device_inline float4 operator/=(float4 &a, float f)
ccl_device_inline float4 operator/(const float4 &a, float f)