Blender  V3.3
noise.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Adapted from Open Shading Language
4  * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
5  * All Rights Reserved.
6  *
7  * Modifications Copyright 2011-2022 Blender Foundation. */
8 
9 #pragma once
10 
12 
13 /* **** Perlin Noise **** */
14 
15 ccl_device float fade(float t)
16 {
17  return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f);
18 }
19 
20 ccl_device_inline float negate_if(float val, int condition)
21 {
22  return (condition) ? -val : val;
23 }
24 
25 ccl_device float grad1(int hash, float x)
26 {
27  int h = hash & 15;
28  float g = 1 + (h & 7);
29  return negate_if(g, h & 8) * x;
30 }
31 
33 {
34  int X;
35  float fx = floorfrac(x, &X);
36  float u = fade(fx);
37 
38  return mix(grad1(hash_uint(X), fx), grad1(hash_uint(X + 1), fx - 1.0f), u);
39 }
40 
41 /* 2D, 3D, and 4D noise can be accelerated using SSE, so we first check if
42  * SSE is supported, that is, if __KERNEL_SSE2__ is defined. If it is not
43  * supported, we do a standard implementation, but if it is supported, we
44  * do an implementation using SSE intrinsics.
45  */
46 #if !defined(__KERNEL_SSE2__)
47 
48 /* ** Standard Implementation ** */
49 
50 /* Bilinear Interpolation:
51  *
52  * v2 v3
53  * @ + + + + @ y
54  * + + ^
55  * + + |
56  * + + |
57  * @ + + + + @ @------> x
58  * v0 v1
59  *
60  */
61 ccl_device float bi_mix(float v0, float v1, float v2, float v3, float x, float y)
62 {
63  float x1 = 1.0f - x;
64  return (1.0f - y) * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x);
65 }
66 
67 /* Trilinear Interpolation:
68  *
69  * v6 v7
70  * @ + + + + + + @
71  * +\ +\
72  * + \ + \
73  * + \ + \
74  * + \ v4 + \ v5
75  * + @ + + + +++ + @ z
76  * + + + + y ^
77  * v2 @ + +++ + + + @ v3 + \ |
78  * \ + \ + \ |
79  * \ + \ + \|
80  * \ + \ + +---------> x
81  * \+ \+
82  * @ + + + + + + @
83  * v0 v1
84  */
85 ccl_device float tri_mix(float v0,
86  float v1,
87  float v2,
88  float v3,
89  float v4,
90  float v5,
91  float v6,
92  float v7,
93  float x,
94  float y,
95  float z)
96 {
97  float x1 = 1.0f - x;
98  float y1 = 1.0f - y;
99  float z1 = 1.0f - z;
100  return z1 * (y1 * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x)) +
101  z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));
102 }
103 
104 ccl_device float quad_mix(float v0,
105  float v1,
106  float v2,
107  float v3,
108  float v4,
109  float v5,
110  float v6,
111  float v7,
112  float v8,
113  float v9,
114  float v10,
115  float v11,
116  float v12,
117  float v13,
118  float v14,
119  float v15,
120  float x,
121  float y,
122  float z,
123  float w)
124 {
125  return mix(tri_mix(v0, v1, v2, v3, v4, v5, v6, v7, x, y, z),
126  tri_mix(v8, v9, v10, v11, v12, v13, v14, v15, x, y, z),
127  w);
128 }
129 
130 ccl_device float grad2(int hash, float x, float y)
131 {
132  int h = hash & 7;
133  float u = h < 4 ? x : y;
134  float v = 2.0f * (h < 4 ? y : x);
135  return negate_if(u, h & 1) + negate_if(v, h & 2);
136 }
137 
138 ccl_device float grad3(int hash, float x, float y, float z)
139 {
140  int h = hash & 15;
141  float u = h < 8 ? x : y;
142  float vt = ((h == 12) || (h == 14)) ? x : z;
143  float v = h < 4 ? y : vt;
144  return negate_if(u, h & 1) + negate_if(v, h & 2);
145 }
146 
147 ccl_device float grad4(int hash, float x, float y, float z, float w)
148 {
149  int h = hash & 31;
150  float u = h < 24 ? x : y;
151  float v = h < 16 ? y : z;
152  float s = h < 8 ? z : w;
153  return negate_if(u, h & 1) + negate_if(v, h & 2) + negate_if(s, h & 4);
154 }
155 
157 {
158  int X;
159  int Y;
160 
161  float fx = floorfrac(x, &X);
162  float fy = floorfrac(y, &Y);
163 
164  float u = fade(fx);
165  float v = fade(fy);
166 
167  float r = bi_mix(grad2(hash_uint2(X, Y), fx, fy),
168  grad2(hash_uint2(X + 1, Y), fx - 1.0f, fy),
169  grad2(hash_uint2(X, Y + 1), fx, fy - 1.0f),
170  grad2(hash_uint2(X + 1, Y + 1), fx - 1.0f, fy - 1.0f),
171  u,
172  v);
173 
174  return r;
175 }
176 
177 ccl_device_noinline_cpu float perlin_3d(float x, float y, float z)
178 {
179  int X;
180  int Y;
181  int Z;
182 
183  float fx = floorfrac(x, &X);
184  float fy = floorfrac(y, &Y);
185  float fz = floorfrac(z, &Z);
186 
187  float u = fade(fx);
188  float v = fade(fy);
189  float w = fade(fz);
190 
191  float r = tri_mix(grad3(hash_uint3(X, Y, Z), fx, fy, fz),
192  grad3(hash_uint3(X + 1, Y, Z), fx - 1.0f, fy, fz),
193  grad3(hash_uint3(X, Y + 1, Z), fx, fy - 1.0f, fz),
194  grad3(hash_uint3(X + 1, Y + 1, Z), fx - 1.0f, fy - 1.0f, fz),
195  grad3(hash_uint3(X, Y, Z + 1), fx, fy, fz - 1.0f),
196  grad3(hash_uint3(X + 1, Y, Z + 1), fx - 1.0f, fy, fz - 1.0f),
197  grad3(hash_uint3(X, Y + 1, Z + 1), fx, fy - 1.0f, fz - 1.0f),
198  grad3(hash_uint3(X + 1, Y + 1, Z + 1), fx - 1.0f, fy - 1.0f, fz - 1.0f),
199  u,
200  v,
201  w);
202  return r;
203 }
204 
205 ccl_device_noinline_cpu float perlin_4d(float x, float y, float z, float w)
206 {
207  int X;
208  int Y;
209  int Z;
210  int W;
211 
212  float fx = floorfrac(x, &X);
213  float fy = floorfrac(y, &Y);
214  float fz = floorfrac(z, &Z);
215  float fw = floorfrac(w, &W);
216 
217  float u = fade(fx);
218  float v = fade(fy);
219  float t = fade(fz);
220  float s = fade(fw);
221 
222  float r = quad_mix(
223  grad4(hash_uint4(X, Y, Z, W), fx, fy, fz, fw),
224  grad4(hash_uint4(X + 1, Y, Z, W), fx - 1.0f, fy, fz, fw),
225  grad4(hash_uint4(X, Y + 1, Z, W), fx, fy - 1.0f, fz, fw),
226  grad4(hash_uint4(X + 1, Y + 1, Z, W), fx - 1.0f, fy - 1.0f, fz, fw),
227  grad4(hash_uint4(X, Y, Z + 1, W), fx, fy, fz - 1.0f, fw),
228  grad4(hash_uint4(X + 1, Y, Z + 1, W), fx - 1.0f, fy, fz - 1.0f, fw),
229  grad4(hash_uint4(X, Y + 1, Z + 1, W), fx, fy - 1.0f, fz - 1.0f, fw),
230  grad4(hash_uint4(X + 1, Y + 1, Z + 1, W), fx - 1.0f, fy - 1.0f, fz - 1.0f, fw),
231  grad4(hash_uint4(X, Y, Z, W + 1), fx, fy, fz, fw - 1.0f),
232  grad4(hash_uint4(X + 1, Y, Z, W + 1), fx - 1.0f, fy, fz, fw - 1.0f),
233  grad4(hash_uint4(X, Y + 1, Z, W + 1), fx, fy - 1.0f, fz, fw - 1.0f),
234  grad4(hash_uint4(X + 1, Y + 1, Z, W + 1), fx - 1.0f, fy - 1.0f, fz, fw - 1.0f),
235  grad4(hash_uint4(X, Y, Z + 1, W + 1), fx, fy, fz - 1.0f, fw - 1.0f),
236  grad4(hash_uint4(X + 1, Y, Z + 1, W + 1), fx - 1.0f, fy, fz - 1.0f, fw - 1.0f),
237  grad4(hash_uint4(X, Y + 1, Z + 1, W + 1), fx, fy - 1.0f, fz - 1.0f, fw - 1.0f),
238  grad4(hash_uint4(X + 1, Y + 1, Z + 1, W + 1), fx - 1.0f, fy - 1.0f, fz - 1.0f, fw - 1.0f),
239  u,
240  v,
241  t,
242  s);
243 
244  return r;
245 }
246 
247 #else /* SSE is supported. */
248 
249 /* ** SSE Implementation ** */
250 
251 /* SSE Bilinear Interpolation:
252  *
253  * The function takes two ssef inputs:
254  * - p : Contains the values at the points (v0, v1, v2, v3).
255  * - f : Contains the values (x, y, _, _). The third and fourth values are unused.
256  *
257  * The interpolation is done in two steps:
258  * 1. Interpolate (v0, v1) and (v2, v3) along the x axis to get g (g0, g1).
259  * (v2, v3) is generated by moving v2 and v3 to the first and second
260  * places of the ssef using the shuffle mask <2, 3, 2, 3>. The third and
261  * fourth values are unused.
262  * 2. Interpolate g0 and g1 along the y axis to get the final value.
263  * g1 is generated by populating an ssef with the second value of g.
264  * Only the first value is important in the final ssef.
265  *
266  * v1 v3 g1
267  * @ + + + + @ @ y
268  * + + (1) + (2) ^
269  * + + ---> + ---> final |
270  * + + + |
271  * @ + + + + @ @ @------> x
272  * v0 v2 g0
273  *
274  */
275 ccl_device_inline ssef bi_mix(ssef p, ssef f)
276 {
277  ssef g = mix(p, shuffle<2, 3, 2, 3>(p), shuffle<0>(f));
278  return mix(g, shuffle<1>(g), shuffle<1>(f));
279 }
280 
281 ccl_device_inline ssef fade(const ssef &t)
282 {
283  ssef a = madd(t, 6.0f, -15.0f);
284  ssef b = madd(t, a, 10.0f);
285  return (t * t) * (t * b);
286 }
287 
288 /* Negate val if the nth bit of h is 1. */
289 # define negate_if_nth_bit(val, h, n) ((val) ^ cast(((h) & (1 << (n))) << (31 - (n))))
290 
291 ccl_device_inline ssef grad(const ssei &hash, const ssef &x, const ssef &y)
292 {
293  ssei h = hash & 7;
294  ssef u = select(h < 4, x, y);
295  ssef v = 2.0f * select(h < 4, y, x);
296  return negate_if_nth_bit(u, h, 0) + negate_if_nth_bit(v, h, 1);
297 }
298 
299 /* We use SSE to compute and interpolate 4 gradients at once:
300  *
301  * Point Offset from v0
302  * v0 (0, 0)
303  * v1 (0, 1)
304  * v2 (1, 0) (0, 1, 0, 1) = shuffle<0, 2, 0, 2>(shuffle<1, 1, 1, 1>(V, V + 1))
305  * v3 (1, 1) ^
306  * | |__________| (0, 0, 1, 1) = shuffle<0, 0, 0, 0>(V, V + 1)
307  * | ^
308  * |__________________________|
309  *
310  */
311 ccl_device_noinline_cpu float perlin_2d(float x, float y)
312 {
313  ssei XY;
314  ssef fxy = floorfrac(ssef(x, y, 0.0f, 0.0f), &XY);
315  ssef uv = fade(fxy);
316 
317  ssei XY1 = XY + 1;
318  ssei X = shuffle<0, 0, 0, 0>(XY, XY1);
319  ssei Y = shuffle<0, 2, 0, 2>(shuffle<1, 1, 1, 1>(XY, XY1));
320 
321  ssei h = hash_ssei2(X, Y);
322 
323  ssef fxy1 = fxy - 1.0f;
324  ssef fx = shuffle<0, 0, 0, 0>(fxy, fxy1);
325  ssef fy = shuffle<0, 2, 0, 2>(shuffle<1, 1, 1, 1>(fxy, fxy1));
326 
327  ssef g = grad(h, fx, fy);
328 
329  return extract<0>(bi_mix(g, uv));
330 }
331 
332 /* SSE Trilinear Interpolation:
333  *
334  * The function takes three ssef inputs:
335  * - p : Contains the values at the points (v0, v1, v2, v3).
336  * - q : Contains the values at the points (v4, v5, v6, v7).
337  * - f : Contains the values (x, y, z, _). The fourth value is unused.
338  *
339  * The interpolation is done in three steps:
340  * 1. Interpolate p and q along the x axis to get s (s0, s1, s2, s3).
341  * 2. Interpolate (s0, s1) and (s2, s3) along the y axis to get g (g0, g1).
342  * (s2, s3) is generated by moving v2 and v3 to the first and second
343  * places of the ssef using the shuffle mask <2, 3, 2, 3>. The third and
344  * fourth values are unused.
345  * 3. Interpolate g0 and g1 along the z axis to get the final value.
346  * g1 is generated by populating an ssef with the second value of g.
347  * Only the first value is important in the final ssef.
348  *
349  * v3 v7
350  * @ + + + + + + @ s3 @
351  * +\ +\ +\
352  * + \ + \ + \
353  * + \ + \ + \ g1
354  * + \ v1 + \ v5 + \ s1 @
355  * + @ + + + +++ + @ + @ + z
356  * + + + + (1) + + (2) + (3) y ^
357  * v2 @ + +++ + + + @ v6 + ---> s2 @ + ---> + ---> final \ |
358  * \ + \ + \ + + \ |
359  * \ + \ + \ + + \|
360  * \ + \ + \ + @ +---------> x
361  * \+ \+ \+ g0
362  * @ + + + + + + @ @
363  * v0 v4 s0
364  */
365 ccl_device_inline ssef tri_mix(ssef p, ssef q, ssef f)
366 {
367  ssef s = mix(p, q, shuffle<0>(f));
368  ssef g = mix(s, shuffle<2, 3, 2, 3>(s), shuffle<1>(f));
369  return mix(g, shuffle<1>(g), shuffle<2>(f));
370 }
371 
372 /* 3D and 4D noise can be accelerated using AVX, so we first check if AVX
373  * is supported, that is, if __KERNEL_AVX__ is defined. If it is not
374  * supported, we do an SSE implementation, but if it is supported,
375  * we do an implementation using AVX intrinsics.
376  */
377 # if !defined(__KERNEL_AVX__)
378 
379 ccl_device_inline ssef grad(const ssei &hash, const ssef &x, const ssef &y, const ssef &z)
380 {
381  ssei h = hash & 15;
382  ssef u = select(h < 8, x, y);
383  ssef vt = select((h == 12) | (h == 14), x, z);
384  ssef v = select(h < 4, y, vt);
385  return negate_if_nth_bit(u, h, 0) + negate_if_nth_bit(v, h, 1);
386 }
387 
389 grad(const ssei &hash, const ssef &x, const ssef &y, const ssef &z, const ssef &w)
390 {
391  ssei h = hash & 31;
392  ssef u = select(h < 24, x, y);
393  ssef v = select(h < 16, y, z);
394  ssef s = select(h < 8, z, w);
395  return negate_if_nth_bit(u, h, 0) + negate_if_nth_bit(v, h, 1) + negate_if_nth_bit(s, h, 2);
396 }
397 
398 /* SSE Quadrilinear Interpolation:
399  *
400  * Quadrilinear interpolation is as simple as a linear interpolation
401  * between two trilinear interpolations.
402  *
403  */
404 ccl_device_inline ssef quad_mix(ssef p, ssef q, ssef r, ssef s, ssef f)
405 {
406  return mix(tri_mix(p, q, f), tri_mix(r, s, f), shuffle<3>(f));
407 }
408 
409 /* We use SSE to compute and interpolate 4 gradients at once. Since we have 8
410  * gradients in 3D, we need to compute two sets of gradients at the points:
411  *
412  * Point Offset from v0
413  * v0 (0, 0, 0)
414  * v1 (0, 0, 1)
415  * v2 (0, 1, 0) (0, 1, 0, 1) = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(V, V + 1))
416  * v3 (0, 1, 1) ^
417  * | |__________| (0, 0, 1, 1) = shuffle<1, 1, 1, 1>(V, V + 1)
418  * | ^
419  * |__________________________|
420  *
421  * Point Offset from v0
422  * v4 (1, 0, 0)
423  * v5 (1, 0, 1)
424  * v6 (1, 1, 0)
425  * v7 (1, 1, 1)
426  *
427  */
428 ccl_device_noinline_cpu float perlin_3d(float x, float y, float z)
429 {
430  ssei XYZ;
431  ssef fxyz = floorfrac(ssef(x, y, z, 0.0f), &XYZ);
432  ssef uvw = fade(fxyz);
433 
434  ssei XYZ1 = XYZ + 1;
435  ssei Y = shuffle<1, 1, 1, 1>(XYZ, XYZ1);
436  ssei Z = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(XYZ, XYZ1));
437 
438  ssei h1 = hash_ssei3(shuffle<0>(XYZ), Y, Z);
439  ssei h2 = hash_ssei3(shuffle<0>(XYZ1), Y, Z);
440 
441  ssef fxyz1 = fxyz - 1.0f;
442  ssef fy = shuffle<1, 1, 1, 1>(fxyz, fxyz1);
443  ssef fz = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(fxyz, fxyz1));
444 
445  ssef g1 = grad(h1, shuffle<0>(fxyz), fy, fz);
446  ssef g2 = grad(h2, shuffle<0>(fxyz1), fy, fz);
447 
448  return extract<0>(tri_mix(g1, g2, uvw));
449 }
450 
451 /* We use SSE to compute and interpolate 4 gradients at once. Since we have 16
452  * gradients in 4D, we need to compute four sets of gradients at the points:
453  *
454  * Point Offset from v0
455  * v0 (0, 0, 0, 0)
456  * v1 (0, 0, 1, 0)
457  * v2 (0, 1, 0, 0) (0, 1, 0, 1) = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(V, V + 1))
458  * v3 (0, 1, 1, 0) ^
459  * | |________| (0, 0, 1, 1) = shuffle<1, 1, 1, 1>(V, V + 1)
460  * | ^
461  * |_______________________|
462  *
463  * Point Offset from v0
464  * v4 (1, 0, 0, 0)
465  * v5 (1, 0, 1, 0)
466  * v6 (1, 1, 0, 0)
467  * v7 (1, 1, 1, 0)
468  *
469  * Point Offset from v0
470  * v8 (0, 0, 0, 1)
471  * v9 (0, 0, 1, 1)
472  * v10 (0, 1, 0, 1)
473  * v11 (0, 1, 1, 1)
474  *
475  * Point Offset from v0
476  * v12 (1, 0, 0, 1)
477  * v13 (1, 0, 1, 1)
478  * v14 (1, 1, 0, 1)
479  * v15 (1, 1, 1, 1)
480  *
481  */
482 ccl_device_noinline_cpu float perlin_4d(float x, float y, float z, float w)
483 {
484  ssei XYZW;
485  ssef fxyzw = floorfrac(ssef(x, y, z, w), &XYZW);
486  ssef uvws = fade(fxyzw);
487 
488  ssei XYZW1 = XYZW + 1;
489  ssei Y = shuffle<1, 1, 1, 1>(XYZW, XYZW1);
490  ssei Z = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(XYZW, XYZW1));
491 
492  ssei h1 = hash_ssei4(shuffle<0>(XYZW), Y, Z, shuffle<3>(XYZW));
493  ssei h2 = hash_ssei4(shuffle<0>(XYZW1), Y, Z, shuffle<3>(XYZW));
494 
495  ssei h3 = hash_ssei4(shuffle<0>(XYZW), Y, Z, shuffle<3>(XYZW1));
496  ssei h4 = hash_ssei4(shuffle<0>(XYZW1), Y, Z, shuffle<3>(XYZW1));
497 
498  ssef fxyzw1 = fxyzw - 1.0f;
499  ssef fy = shuffle<1, 1, 1, 1>(fxyzw, fxyzw1);
500  ssef fz = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(fxyzw, fxyzw1));
501 
502  ssef g1 = grad(h1, shuffle<0>(fxyzw), fy, fz, shuffle<3>(fxyzw));
503  ssef g2 = grad(h2, shuffle<0>(fxyzw1), fy, fz, shuffle<3>(fxyzw));
504 
505  ssef g3 = grad(h3, shuffle<0>(fxyzw), fy, fz, shuffle<3>(fxyzw1));
506  ssef g4 = grad(h4, shuffle<0>(fxyzw1), fy, fz, shuffle<3>(fxyzw1));
507 
508  return extract<0>(quad_mix(g1, g2, g3, g4, uvws));
509 }
510 
511 # else /* AVX is supported. */
512 
513 /* AVX Implementation */
514 
515 ccl_device_inline avxf grad(const avxi &hash, const avxf &x, const avxf &y, const avxf &z)
516 {
517  avxi h = hash & 15;
518  avxf u = select(h < 8, x, y);
519  avxf vt = select((h == 12) | (h == 14), x, z);
520  avxf v = select(h < 4, y, vt);
521  return negate_if_nth_bit(u, h, 0) + negate_if_nth_bit(v, h, 1);
522 }
523 
525 grad(const avxi &hash, const avxf &x, const avxf &y, const avxf &z, const avxf &w)
526 {
527  avxi h = hash & 31;
528  avxf u = select(h < 24, x, y);
529  avxf v = select(h < 16, y, z);
530  avxf s = select(h < 8, z, w);
531  return negate_if_nth_bit(u, h, 0) + negate_if_nth_bit(v, h, 1) + negate_if_nth_bit(s, h, 2);
532 }
533 
534 /* SSE Quadrilinear Interpolation:
535  *
536  * The interpolation is done in two steps:
537  * 1. Interpolate p and q along the w axis to get s.
538  * 2. Trilinearly interpolate (s0, s1, s2, s3) and (s4, s5, s6, s7) to get the final
539  * value. (s0, s1, s2, s3) and (s4, s5, s6, s7) are generated by extracting the
540  * low and high ssef from s.
541  *
542  */
543 ccl_device_inline ssef quad_mix(avxf p, avxf q, ssef f)
544 {
545  ssef fv = shuffle<3>(f);
546  avxf s = mix(p, q, avxf(fv, fv));
547  return tri_mix(low(s), high(s), f);
548 }
549 
550 /* We use AVX to compute and interpolate 8 gradients at once.
551  *
552  * Point Offset from v0
553  * v0 (0, 0, 0)
554  * v1 (0, 0, 1) The full AVX type is computed by inserting the following
555  * v2 (0, 1, 0) SSE types into both the low and high parts of the AVX.
556  * v3 (0, 1, 1)
557  * v4 (1, 0, 0)
558  * v5 (1, 0, 1) (0, 1, 0, 1) = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(V, V + 1))
559  * v6 (1, 1, 0) ^
560  * v7 (1, 1, 1) |
561  * | |__________| (0, 0, 1, 1) = shuffle<1, 1, 1, 1>(V, V + 1)
562  * | ^
563  * |__________________________|
564  *
565  */
566 ccl_device_noinline_cpu float perlin_3d(float x, float y, float z)
567 {
568  ssei XYZ;
569  ssef fxyz = floorfrac(ssef(x, y, z, 0.0f), &XYZ);
570  ssef uvw = fade(fxyz);
571 
572  ssei XYZ1 = XYZ + 1;
573  ssei X = shuffle<0>(XYZ);
574  ssei X1 = shuffle<0>(XYZ1);
575  ssei Y = shuffle<1, 1, 1, 1>(XYZ, XYZ1);
576  ssei Z = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(XYZ, XYZ1));
577 
578  avxi h = hash_avxi3(avxi(X, X1), avxi(Y, Y), avxi(Z, Z));
579 
580  ssef fxyz1 = fxyz - 1.0f;
581  ssef fx = shuffle<0>(fxyz);
582  ssef fx1 = shuffle<0>(fxyz1);
583  ssef fy = shuffle<1, 1, 1, 1>(fxyz, fxyz1);
584  ssef fz = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(fxyz, fxyz1));
585 
586  avxf g = grad(h, avxf(fx, fx1), avxf(fy, fy), avxf(fz, fz));
587 
588  return extract<0>(tri_mix(low(g), high(g), uvw));
589 }
590 
591 /* We use AVX to compute and interpolate 8 gradients at once. Since we have 16
592  * gradients in 4D, we need to compute two sets of gradients at the points:
593  *
594  * Point Offset from v0
595  * v0 (0, 0, 0, 0)
596  * v1 (0, 0, 1, 0) The full AVX type is computed by inserting the following
597  * v2 (0, 1, 0, 0) SSE types into both the low and high parts of the AVX.
598  * v3 (0, 1, 1, 0)
599  * v4 (1, 0, 0, 0)
600  * v5 (1, 0, 1, 0) (0, 1, 0, 1) = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(V, V + 1))
601  * v6 (1, 1, 0, 0) ^
602  * v7 (1, 1, 1, 0) |
603  * | |________| (0, 0, 1, 1) = shuffle<1, 1, 1, 1>(V, V + 1)
604  * | ^
605  * |_______________________|
606  *
607  * Point Offset from v0
608  * v8 (0, 0, 0, 1)
609  * v9 (0, 0, 1, 1)
610  * v10 (0, 1, 0, 1)
611  * v11 (0, 1, 1, 1)
612  * v12 (1, 0, 0, 1)
613  * v13 (1, 0, 1, 1)
614  * v14 (1, 1, 0, 1)
615  * v15 (1, 1, 1, 1)
616  *
617  */
618 ccl_device_noinline_cpu float perlin_4d(float x, float y, float z, float w)
619 {
620  ssei XYZW;
621  ssef fxyzw = floorfrac(ssef(x, y, z, w), &XYZW);
622  ssef uvws = fade(fxyzw);
623 
624  ssei XYZW1 = XYZW + 1;
625  ssei X = shuffle<0>(XYZW);
626  ssei X1 = shuffle<0>(XYZW1);
627  ssei Y = shuffle<1, 1, 1, 1>(XYZW, XYZW1);
628  ssei Z = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(XYZW, XYZW1));
629  ssei W = shuffle<3>(XYZW);
630  ssei W1 = shuffle<3>(XYZW1);
631 
632  avxi h1 = hash_avxi4(avxi(X, X1), avxi(Y, Y), avxi(Z, Z), avxi(W, W));
633  avxi h2 = hash_avxi4(avxi(X, X1), avxi(Y, Y), avxi(Z, Z), avxi(W1, W1));
634 
635  ssef fxyzw1 = fxyzw - 1.0f;
636  ssef fx = shuffle<0>(fxyzw);
637  ssef fx1 = shuffle<0>(fxyzw1);
638  ssef fy = shuffle<1, 1, 1, 1>(fxyzw, fxyzw1);
639  ssef fz = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(fxyzw, fxyzw1));
640  ssef fw = shuffle<3>(fxyzw);
641  ssef fw1 = shuffle<3>(fxyzw1);
642 
643  avxf g1 = grad(h1, avxf(fx, fx1), avxf(fy, fy), avxf(fz, fz), avxf(fw, fw));
644  avxf g2 = grad(h2, avxf(fx, fx1), avxf(fy, fy), avxf(fz, fz), avxf(fw1, fw1));
645 
646  return extract<0>(quad_mix(g1, g2, uvws));
647 }
648 # endif
649 
650 # undef negate_if_nth_bit
651 
652 #endif
653 
654 /* Remap the output of noise to a predictable range [-1, 1].
655  * The scale values were computed experimentally by the OSL developers.
656  */
657 
659 {
660  return 0.2500f * result;
661 }
662 
664 {
665  return 0.6616f * result;
666 }
667 
669 {
670  return 0.9820f * result;
671 }
672 
674 {
675  return 0.8344f * result;
676 }
677 
678 /* Safe Signed And Unsigned Noise */
679 
681 {
683 }
684 
686 {
687  return 0.5f * snoise_1d(p) + 0.5f;
688 }
689 
691 {
692  return noise_scale2(ensure_finite(perlin_2d(p.x, p.y)));
693 }
694 
696 {
697  return 0.5f * snoise_2d(p) + 0.5f;
698 }
699 
701 {
702  return noise_scale3(ensure_finite(perlin_3d(p.x, p.y, p.z)));
703 }
704 
706 {
707  return 0.5f * snoise_3d(p) + 0.5f;
708 }
709 
711 {
712  return noise_scale4(ensure_finite(perlin_4d(p.x, p.y, p.z, p.w)));
713 }
714 
716 {
717  return 0.5f * snoise_4d(p) + 0.5f;
718 }
719 
_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 z
_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 y1
_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 GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 y
_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
_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 v1
float float4[4]
#define Z
Definition: GeomUtils.cpp:201
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its X
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its Y
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate XYZ
#define X1
Definition: RandGen.cpp:20
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
Definition: avxf.h:321
__forceinline ssef low(const avxf &a)
Definition: avxf.h:264
__forceinline ssef high(const avxf &a)
Definition: avxf.h:268
__forceinline float extract< 0 >(const avxf &a)
Definition: avxf.h:259
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define XY(_x, _y)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
#define ccl_device
Definition: cuda/compat.h:32
#define ccl_device_noinline_cpu
Definition: cuda/compat.h:41
#define ccl_device_inline
Definition: cuda/compat.h:34
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_device_inline uint hash_uint2(uint kx, uint ky)
Definition: hash.h:70
ccl_device_inline uint hash_uint3(uint kx, uint ky, uint kz)
Definition: hash.h:82
ccl_device_inline uint hash_uint4(uint kx, uint ky, uint kz, uint kw)
Definition: hash.h:95
ccl_device_inline uint hash_uint(uint kx)
Definition: hash.h:59
#define mix(a, b, c)
Definition: hash.h:17
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
#define hash
Definition: noise.c:153
BLI_INLINE float grad(int hash_val, float x, float y, float z)
Definition: noise.c:270
ccl_device float grad4(int hash, float x, float y, float z, float w)
Definition: noise.h:147
ccl_device float quad_mix(float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9, float v10, float v11, float v12, float v13, float v14, float v15, float x, float y, float z, float w)
Definition: noise.h:104
ccl_device_inline float snoise_1d(float p)
Definition: noise.h:680
ccl_device float grad3(int hash, float x, float y, float z)
Definition: noise.h:138
ccl_device_noinline_cpu float perlin_2d(float x, float y)
Definition: noise.h:156
ccl_device_inline float noise_scale4(float result)
Definition: noise.h:673
ccl_device float bi_mix(float v0, float v1, float v2, float v3, float x, float y)
Definition: noise.h:61
ccl_device_inline float noise_2d(float2 p)
Definition: noise.h:695
ccl_device_inline float snoise_2d(float2 p)
Definition: noise.h:690
ccl_device float tri_mix(float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float x, float y, float z)
Definition: noise.h:85
ccl_device_inline float snoise_3d(float3 p)
Definition: noise.h:700
ccl_device_inline float snoise_4d(float4 p)
Definition: noise.h:710
ccl_device_inline float noise_3d(float3 p)
Definition: noise.h:705
ccl_device_inline float noise_4d(float4 p)
Definition: noise.h:715
ccl_device_inline float noise_scale3(float result)
Definition: noise.h:668
ccl_device_inline float noise_scale2(float result)
Definition: noise.h:663
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
Definition: noise.h:15
ccl_device float grad2(int hash, float x, float y)
Definition: noise.h:130
ccl_device_inline float noise_1d(float p)
Definition: noise.h:685
ccl_device_inline float negate_if(float val, int condition)
Definition: noise.h:20
ccl_device_noinline_cpu float perlin_4d(float x, float y, float z, float w)
Definition: noise.h:205
ccl_device float grad1(int hash, float x)
Definition: noise.h:25
ccl_device_inline float noise_scale1(float result)
Definition: noise.h:658
ccl_device_noinline_cpu float perlin_1d(float x)
Definition: noise.h:32
ccl_device_noinline_cpu float perlin_3d(float x, float y, float z)
Definition: noise.h:177
Definition: avxf.h:11
Definition: avxi.h:11
float x
Definition: types_float2.h:15
float y
Definition: types_float2.h:15
float z
float y
float x
ccl_device_inline float ensure_finite(float v)
Definition: util/math.h:361
ccl_device_inline float floorfrac(float x, ccl_private int *i)
Definition: util/math.h:420