Blender  V2.93
kernel_cpu_image.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 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 __KERNEL_CPU_IMAGE_H__
18 #define __KERNEL_CPU_IMAGE_H__
19 
20 #ifdef WITH_NANOVDB
21 # define NANOVDB_USE_INTRINSICS
22 # include <nanovdb/NanoVDB.h>
23 # include <nanovdb/util/SampleFromVoxels.h>
24 #endif
25 
27 
28 /* Make template functions private so symbols don't conflict between kernels with different
29  * instruction sets. */
30 namespace {
31 
32 #define SET_CUBIC_SPLINE_WEIGHTS(u, t) \
33  { \
34  u[0] = (((-1.0f / 6.0f) * t + 0.5f) * t - 0.5f) * t + (1.0f / 6.0f); \
35  u[1] = ((0.5f * t - 1.0f) * t) * t + (2.0f / 3.0f); \
36  u[2] = ((-0.5f * t + 0.5f) * t + 0.5f) * t + (1.0f / 6.0f); \
37  u[3] = (1.0f / 6.0f) * t * t * t; \
38  } \
39  (void)0
40 
41 ccl_device_inline float frac(float x, int *ix)
42 {
43  int i = float_to_int(x) - ((x < 0.0f) ? 1 : 0);
44  *ix = i;
45  return x - (float)i;
46 }
47 
48 template<typename T> struct TextureInterpolator {
49 
50  static ccl_always_inline float4 read(float4 r)
51  {
52  return r;
53  }
54 
55  static ccl_always_inline float4 read(uchar4 r)
56  {
57  float f = 1.0f / 255.0f;
58  return make_float4(r.x * f, r.y * f, r.z * f, r.w * f);
59  }
60 
61  static ccl_always_inline float4 read(uchar r)
62  {
63  float f = r * (1.0f / 255.0f);
64  return make_float4(f, f, f, 1.0f);
65  }
66 
67  static ccl_always_inline float4 read(float r)
68  {
69  /* TODO(dingto): Optimize this, so interpolation
70  * happens on float instead of float4 */
71  return make_float4(r, r, r, 1.0f);
72  }
73 
74  static ccl_always_inline float4 read(half4 r)
75  {
76  return half4_to_float4(r);
77  }
78 
79  static ccl_always_inline float4 read(half r)
80  {
81  float f = half_to_float(r);
82  return make_float4(f, f, f, 1.0f);
83  }
84 
86  {
87  float f = r * (1.0f / 65535.0f);
88  return make_float4(f, f, f, 1.0f);
89  }
90 
92  {
93  float f = 1.0f / 65535.0f;
94  return make_float4(r.x * f, r.y * f, r.z * f, r.w * f);
95  }
96 
97  static ccl_always_inline float4 read(const T *data, int x, int y, int width, int height)
98  {
99  if (x < 0 || y < 0 || x >= width || y >= height) {
100  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
101  }
102  return read(data[y * width + x]);
103  }
104 
105  static ccl_always_inline int wrap_periodic(int x, int width)
106  {
107  x %= width;
108  if (x < 0)
109  x += width;
110  return x;
111  }
112 
113  static ccl_always_inline int wrap_clamp(int x, int width)
114  {
115  return clamp(x, 0, width - 1);
116  }
117 
118  /* ******** 2D interpolation ******** */
119 
120  static ccl_always_inline float4 interp_closest(const TextureInfo &info, float x, float y)
121  {
122  const T *data = (const T *)info.data;
123  const int width = info.width;
124  const int height = info.height;
125  int ix, iy;
126  frac(x * (float)width, &ix);
127  frac(y * (float)height, &iy);
128  switch (info.extension) {
129  case EXTENSION_REPEAT:
130  ix = wrap_periodic(ix, width);
131  iy = wrap_periodic(iy, height);
132  break;
133  case EXTENSION_CLIP:
134  if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
135  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
136  }
138  case EXTENSION_EXTEND:
139  ix = wrap_clamp(ix, width);
140  iy = wrap_clamp(iy, height);
141  break;
142  default:
143  kernel_assert(0);
144  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
145  }
146  return read(data[ix + iy * width]);
147  }
148 
149  static ccl_always_inline float4 interp_linear(const TextureInfo &info, float x, float y)
150  {
151  const T *data = (const T *)info.data;
152  const int width = info.width;
153  const int height = info.height;
154  int ix, iy, nix, niy;
155  const float tx = frac(x * (float)width - 0.5f, &ix);
156  const float ty = frac(y * (float)height - 0.5f, &iy);
157  switch (info.extension) {
158  case EXTENSION_REPEAT:
159  ix = wrap_periodic(ix, width);
160  iy = wrap_periodic(iy, height);
161  nix = wrap_periodic(ix + 1, width);
162  niy = wrap_periodic(iy + 1, height);
163  break;
164  case EXTENSION_CLIP:
165  nix = ix + 1;
166  niy = iy + 1;
167  break;
168  case EXTENSION_EXTEND:
169  nix = wrap_clamp(ix + 1, width);
170  niy = wrap_clamp(iy + 1, height);
171  ix = wrap_clamp(ix, width);
172  iy = wrap_clamp(iy, height);
173  break;
174  default:
175  kernel_assert(0);
176  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
177  }
178  return (1.0f - ty) * (1.0f - tx) * read(data, ix, iy, width, height) +
179  (1.0f - ty) * tx * read(data, nix, iy, width, height) +
180  ty * (1.0f - tx) * read(data, ix, niy, width, height) +
181  ty * tx * read(data, nix, niy, width, height);
182  }
183 
184  static ccl_always_inline float4 interp_cubic(const TextureInfo &info, float x, float y)
185  {
186  const T *data = (const T *)info.data;
187  const int width = info.width;
188  const int height = info.height;
189  int ix, iy, nix, niy;
190  const float tx = frac(x * (float)width - 0.5f, &ix);
191  const float ty = frac(y * (float)height - 0.5f, &iy);
192  int pix, piy, nnix, nniy;
193  switch (info.extension) {
194  case EXTENSION_REPEAT:
195  ix = wrap_periodic(ix, width);
196  iy = wrap_periodic(iy, height);
197  pix = wrap_periodic(ix - 1, width);
198  piy = wrap_periodic(iy - 1, height);
199  nix = wrap_periodic(ix + 1, width);
200  niy = wrap_periodic(iy + 1, height);
201  nnix = wrap_periodic(ix + 2, width);
202  nniy = wrap_periodic(iy + 2, height);
203  break;
204  case EXTENSION_CLIP:
205  pix = ix - 1;
206  piy = iy - 1;
207  nix = ix + 1;
208  niy = iy + 1;
209  nnix = ix + 2;
210  nniy = iy + 2;
211  break;
212  case EXTENSION_EXTEND:
213  pix = wrap_clamp(ix - 1, width);
214  piy = wrap_clamp(iy - 1, height);
215  nix = wrap_clamp(ix + 1, width);
216  niy = wrap_clamp(iy + 1, height);
217  nnix = wrap_clamp(ix + 2, width);
218  nniy = wrap_clamp(iy + 2, height);
219  ix = wrap_clamp(ix, width);
220  iy = wrap_clamp(iy, height);
221  break;
222  default:
223  kernel_assert(0);
224  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
225  }
226  const int xc[4] = {pix, ix, nix, nnix};
227  const int yc[4] = {piy, iy, niy, nniy};
228  float u[4], v[4];
229  /* Some helper macro to keep code reasonable size,
230  * let compiler to inline all the matrix multiplications.
231  */
232 #define DATA(x, y) (read(data, xc[x], yc[y], width, height))
233 #define TERM(col) \
234  (v[col] * \
235  (u[0] * DATA(0, col) + u[1] * DATA(1, col) + u[2] * DATA(2, col) + u[3] * DATA(3, col)))
236 
239 
240  /* Actual interpolation. */
241  return TERM(0) + TERM(1) + TERM(2) + TERM(3);
242 #undef TERM
243 #undef DATA
244  }
245 
246  static ccl_always_inline float4 interp(const TextureInfo &info, float x, float y)
247  {
248  if (UNLIKELY(!info.data)) {
249  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
250  }
251  switch (info.interpolation) {
253  return interp_closest(info, x, y);
255  return interp_linear(info, x, y);
256  default:
257  return interp_cubic(info, x, y);
258  }
259  }
260 
261  /* ******** 3D interpolation ******** */
262 
264  float x,
265  float y,
266  float z)
267  {
268  int width = info.width;
269  int height = info.height;
270  int depth = info.depth;
271  int ix, iy, iz;
272 
273  frac(x * (float)width, &ix);
274  frac(y * (float)height, &iy);
275  frac(z * (float)depth, &iz);
276 
277  switch (info.extension) {
278  case EXTENSION_REPEAT:
279  ix = wrap_periodic(ix, width);
280  iy = wrap_periodic(iy, height);
281  iz = wrap_periodic(iz, depth);
282  break;
283  case EXTENSION_CLIP:
284  if (x < 0.0f || y < 0.0f || z < 0.0f || x > 1.0f || y > 1.0f || z > 1.0f) {
285  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
286  }
288  case EXTENSION_EXTEND:
289  ix = wrap_clamp(ix, width);
290  iy = wrap_clamp(iy, height);
291  iz = wrap_clamp(iz, depth);
292  break;
293  default:
294  kernel_assert(0);
295  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
296  }
297 
298  const T *data = (const T *)info.data;
299  return read(data[ix + iy * width + iz * width * height]);
300  }
301 
302  static ccl_always_inline float4 interp_3d_linear(const TextureInfo &info,
303  float x,
304  float y,
305  float z)
306  {
307  int width = info.width;
308  int height = info.height;
309  int depth = info.depth;
310  int ix, iy, iz;
311  int nix, niy, niz;
312 
313  float tx = frac(x * (float)width - 0.5f, &ix);
314  float ty = frac(y * (float)height - 0.5f, &iy);
315  float tz = frac(z * (float)depth - 0.5f, &iz);
316 
317  switch (info.extension) {
318  case EXTENSION_REPEAT:
319  ix = wrap_periodic(ix, width);
320  iy = wrap_periodic(iy, height);
321  iz = wrap_periodic(iz, depth);
322 
323  nix = wrap_periodic(ix + 1, width);
324  niy = wrap_periodic(iy + 1, height);
325  niz = wrap_periodic(iz + 1, depth);
326  break;
327  case EXTENSION_CLIP:
328  if (x < 0.0f || y < 0.0f || z < 0.0f || x > 1.0f || y > 1.0f || z > 1.0f) {
329  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
330  }
332  case EXTENSION_EXTEND:
333  nix = wrap_clamp(ix + 1, width);
334  niy = wrap_clamp(iy + 1, height);
335  niz = wrap_clamp(iz + 1, depth);
336 
337  ix = wrap_clamp(ix, width);
338  iy = wrap_clamp(iy, height);
339  iz = wrap_clamp(iz, depth);
340  break;
341  default:
342  kernel_assert(0);
343  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
344  }
345 
346  const T *data = (const T *)info.data;
347  float4 r;
348 
349  r = (1.0f - tz) * (1.0f - ty) * (1.0f - tx) *
350  read(data[ix + iy * width + iz * width * height]);
351  r += (1.0f - tz) * (1.0f - ty) * tx * read(data[nix + iy * width + iz * width * height]);
352  r += (1.0f - tz) * ty * (1.0f - tx) * read(data[ix + niy * width + iz * width * height]);
353  r += (1.0f - tz) * ty * tx * read(data[nix + niy * width + iz * width * height]);
354 
355  r += tz * (1.0f - ty) * (1.0f - tx) * read(data[ix + iy * width + niz * width * height]);
356  r += tz * (1.0f - ty) * tx * read(data[nix + iy * width + niz * width * height]);
357  r += tz * ty * (1.0f - tx) * read(data[ix + niy * width + niz * width * height]);
358  r += tz * ty * tx * read(data[nix + niy * width + niz * width * height]);
359 
360  return r;
361  }
362 
363  /* TODO(sergey): For some unspeakable reason both GCC-6 and Clang-3.9 are
364  * causing stack overflow issue in this function unless it is inlined.
365  *
366  * Only happens for AVX2 kernel and global __KERNEL_SSE__ vectorization
367  * enabled.
368  */
369 #if defined(__GNUC__) || defined(__clang__)
370  static ccl_always_inline
371 #else
372  static ccl_never_inline
373 #endif
374  float4
375  interp_3d_cubic(const TextureInfo &info, float x, float y, float z)
376  {
377  int width = info.width;
378  int height = info.height;
379  int depth = info.depth;
380  int ix, iy, iz;
381  int nix, niy, niz;
382  /* Tricubic b-spline interpolation. */
383  const float tx = frac(x * (float)width - 0.5f, &ix);
384  const float ty = frac(y * (float)height - 0.5f, &iy);
385  const float tz = frac(z * (float)depth - 0.5f, &iz);
386  int pix, piy, piz, nnix, nniy, nniz;
387 
388  switch (info.extension) {
389  case EXTENSION_REPEAT:
390  ix = wrap_periodic(ix, width);
391  iy = wrap_periodic(iy, height);
392  iz = wrap_periodic(iz, depth);
393 
394  pix = wrap_periodic(ix - 1, width);
395  piy = wrap_periodic(iy - 1, height);
396  piz = wrap_periodic(iz - 1, depth);
397 
398  nix = wrap_periodic(ix + 1, width);
399  niy = wrap_periodic(iy + 1, height);
400  niz = wrap_periodic(iz + 1, depth);
401 
402  nnix = wrap_periodic(ix + 2, width);
403  nniy = wrap_periodic(iy + 2, height);
404  nniz = wrap_periodic(iz + 2, depth);
405  break;
406  case EXTENSION_CLIP:
407  if (x < 0.0f || y < 0.0f || z < 0.0f || x > 1.0f || y > 1.0f || z > 1.0f) {
408  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
409  }
411  case EXTENSION_EXTEND:
412  pix = wrap_clamp(ix - 1, width);
413  piy = wrap_clamp(iy - 1, height);
414  piz = wrap_clamp(iz - 1, depth);
415 
416  nix = wrap_clamp(ix + 1, width);
417  niy = wrap_clamp(iy + 1, height);
418  niz = wrap_clamp(iz + 1, depth);
419 
420  nnix = wrap_clamp(ix + 2, width);
421  nniy = wrap_clamp(iy + 2, height);
422  nniz = wrap_clamp(iz + 2, depth);
423 
424  ix = wrap_clamp(ix, width);
425  iy = wrap_clamp(iy, height);
426  iz = wrap_clamp(iz, depth);
427  break;
428  default:
429  kernel_assert(0);
430  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
431  }
432 
433  const int xc[4] = {pix, ix, nix, nnix};
434  const int yc[4] = {width * piy, width * iy, width * niy, width * nniy};
435  const int zc[4] = {
436  width * height * piz, width * height * iz, width * height * niz, width * height * nniz};
437  float u[4], v[4], w[4];
438 
439  /* Some helper macro to keep code reasonable size,
440  * let compiler to inline all the matrix multiplications.
441  */
442 #define DATA(x, y, z) (read(data[xc[x] + yc[y] + zc[z]]))
443 #define COL_TERM(col, row) \
444  (v[col] * (u[0] * DATA(0, col, row) + u[1] * DATA(1, col, row) + u[2] * DATA(2, col, row) + \
445  u[3] * DATA(3, col, row)))
446 #define ROW_TERM(row) \
447  (w[row] * (COL_TERM(0, row) + COL_TERM(1, row) + COL_TERM(2, row) + COL_TERM(3, row)))
448 
452 
453  /* Actual interpolation. */
454  const T *data = (const T *)info.data;
455  return ROW_TERM(0) + ROW_TERM(1) + ROW_TERM(2) + ROW_TERM(3);
456 
457 #undef COL_TERM
458 #undef ROW_TERM
459 #undef DATA
460  }
461 
462  static ccl_always_inline float4
463  interp_3d(const TextureInfo &info, float x, float y, float z, InterpolationType interp)
464  {
465  if (UNLIKELY(!info.data))
466  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
467 
468  switch ((interp == INTERPOLATION_NONE) ? info.interpolation : interp) {
470  return interp_3d_closest(info, x, y, z);
472  return interp_3d_linear(info, x, y, z);
473  default:
474  return interp_3d_cubic(info, x, y, z);
475  }
476  }
477 };
478 
479 #ifdef WITH_NANOVDB
480 template<typename T> struct NanoVDBInterpolator {
481 
482  typedef typename nanovdb::NanoGrid<T>::AccessorType AccessorType;
483 
484  static ccl_always_inline float4 read(float r)
485  {
486  return make_float4(r, r, r, 1.0f);
487  }
488 
489  static ccl_always_inline float4 read(nanovdb::Vec3f r)
490  {
491  return make_float4(r[0], r[1], r[2], 1.0f);
492  }
493 
494  static ccl_always_inline float4 interp_3d_closest(const AccessorType &acc,
495  float x,
496  float y,
497  float z)
498  {
499  const nanovdb::Vec3f xyz(x, y, z);
500  return read(nanovdb::SampleFromVoxels<AccessorType, 0, false>(acc)(xyz));
501  }
502 
503  static ccl_always_inline float4 interp_3d_linear(const AccessorType &acc,
504  float x,
505  float y,
506  float z)
507  {
508  const nanovdb::Vec3f xyz(x - 0.5f, y - 0.5f, z - 0.5f);
509  return read(nanovdb::SampleFromVoxels<AccessorType, 1, false>(acc)(xyz));
510  }
511 
512 # if defined(__GNUC__) || defined(__clang__)
513  static ccl_always_inline
514 # else
515  static ccl_never_inline
516 # endif
517  float4
518  interp_3d_cubic(const AccessorType &acc, float x, float y, float z)
519  {
520  int ix, iy, iz;
521  int nix, niy, niz;
522  int pix, piy, piz;
523  int nnix, nniy, nniz;
524  /* Tricubic b-spline interpolation. */
525  const float tx = frac(x - 0.5f, &ix);
526  const float ty = frac(y - 0.5f, &iy);
527  const float tz = frac(z - 0.5f, &iz);
528  pix = ix - 1;
529  piy = iy - 1;
530  piz = iz - 1;
531  nix = ix + 1;
532  niy = iy + 1;
533  niz = iz + 1;
534  nnix = ix + 2;
535  nniy = iy + 2;
536  nniz = iz + 2;
537 
538  const int xc[4] = {pix, ix, nix, nnix};
539  const int yc[4] = {piy, iy, niy, nniy};
540  const int zc[4] = {piz, iz, niz, nniz};
541  float u[4], v[4], w[4];
542 
543  /* Some helper macro to keep code reasonable size,
544  * let compiler to inline all the matrix multiplications.
545  */
546 # define DATA(x, y, z) (read(acc.getValue(nanovdb::Coord(xc[x], yc[y], zc[z]))))
547 # define COL_TERM(col, row) \
548  (v[col] * (u[0] * DATA(0, col, row) + u[1] * DATA(1, col, row) + u[2] * DATA(2, col, row) + \
549  u[3] * DATA(3, col, row)))
550 # define ROW_TERM(row) \
551  (w[row] * (COL_TERM(0, row) + COL_TERM(1, row) + COL_TERM(2, row) + COL_TERM(3, row)))
552 
556 
557  /* Actual interpolation. */
558  return ROW_TERM(0) + ROW_TERM(1) + ROW_TERM(2) + ROW_TERM(3);
559 
560 # undef COL_TERM
561 # undef ROW_TERM
562 # undef DATA
563  }
564 
565  static ccl_always_inline float4
566  interp_3d(const TextureInfo &info, float x, float y, float z, InterpolationType interp)
567  {
568  using namespace nanovdb;
569 
570  NanoGrid<T> *const grid = (NanoGrid<T> *)info.data;
571  AccessorType acc = grid->getAccessor();
572 
573  switch ((interp == INTERPOLATION_NONE) ? info.interpolation : interp) {
575  return interp_3d_closest(acc, x, y, z);
577  return interp_3d_linear(acc, x, y, z);
578  default:
579  return interp_3d_cubic(acc, x, y, z);
580  }
581  }
582 };
583 #endif
584 
585 #undef SET_CUBIC_SPLINE_WEIGHTS
586 
587 ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, float y)
588 {
589  const TextureInfo &info = kernel_tex_fetch(__texture_info, id);
590 
591  switch (info.data_type) {
593  return TextureInterpolator<half>::interp(info, x, y);
595  return TextureInterpolator<uchar>::interp(info, x, y);
599  return TextureInterpolator<float>::interp(info, x, y);
601  return TextureInterpolator<half4>::interp(info, x, y);
603  return TextureInterpolator<uchar4>::interp(info, x, y);
607  return TextureInterpolator<float4>::interp(info, x, y);
608  default:
609  assert(0);
610  return make_float4(
612  }
613 }
614 
616  int id,
617  float3 P,
619 {
620  const TextureInfo &info = kernel_tex_fetch(__texture_info, id);
621 
622  if (info.use_transform_3d) {
623  P = transform_point(&info.transform_3d, P);
624  }
625 
626  switch (info.data_type) {
628  return TextureInterpolator<half>::interp_3d(info, P.x, P.y, P.z, interp);
630  return TextureInterpolator<uchar>::interp_3d(info, P.x, P.y, P.z, interp);
632  return TextureInterpolator<uint16_t>::interp_3d(info, P.x, P.y, P.z, interp);
634  return TextureInterpolator<float>::interp_3d(info, P.x, P.y, P.z, interp);
636  return TextureInterpolator<half4>::interp_3d(info, P.x, P.y, P.z, interp);
638  return TextureInterpolator<uchar4>::interp_3d(info, P.x, P.y, P.z, interp);
640  return TextureInterpolator<ushort4>::interp_3d(info, P.x, P.y, P.z, interp);
642  return TextureInterpolator<float4>::interp_3d(info, P.x, P.y, P.z, interp);
643 #ifdef WITH_NANOVDB
645  return NanoVDBInterpolator<float>::interp_3d(info, P.x, P.y, P.z, interp);
647  return NanoVDBInterpolator<nanovdb::Vec3f>::interp_3d(info, P.x, P.y, P.z, interp);
648 #endif
649  default:
650  assert(0);
651  return make_float4(
653  }
654 }
655 
656 } /* Namespace. */
657 
659 
660 #endif // __KERNEL_CPU_IMAGE_H__
typedef float(TangentPoint)[2]
#define ATTR_FALLTHROUGH
unsigned char uchar
Definition: BLI_sys_types.h:86
#define UNLIKELY(x)
_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 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 GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_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
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
Definition: util_half.h:41
struct Vec3f Vec3f
#define kernel_assert(cond)
#define kernel_tex_fetch(tex, index)
#define ccl_device
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define make_float4(x, y, z, w)
#define TERM(col)
#define SET_CUBIC_SPLINE_WEIGHTS(u, t)
#define ROW_TERM(row)
static float P(float k)
Definition: math_interp.c:41
#define T
ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, float y)
ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float3 P, InterpolationType interp)
ccl_device_inline float frac(float x, int *ix)
unsigned short uint16_t
Definition: stdint.h:82
static ccl_always_inline float4 interp_closest(const TextureInfo &info, float x, float y)
static ccl_never_inline float4 interp_3d_cubic(const TextureInfo &info, float x, float y, float z)
static ccl_always_inline float4 interp_3d(const TextureInfo &info, float x, float y, float z, InterpolationType interp)
static ccl_always_inline float4 interp_cubic(const TextureInfo &info, float x, float y)
static ccl_always_inline float4 read(float r)
static ccl_always_inline int wrap_clamp(int x, int width)
static ccl_always_inline float4 interp_3d_closest(const TextureInfo &info, float x, float y, float z)
static ccl_always_inline float4 read(half4 r)
static ccl_always_inline float4 read(const T *data, int x, int y, int width, int height)
static ccl_always_inline float4 read(half r)
static ccl_always_inline float4 interp_linear(const TextureInfo &info, float x, float y)
static ccl_always_inline float4 read(uchar4 r)
static ccl_always_inline float4 read(uchar r)
static ccl_always_inline int wrap_periodic(int x, int width)
static ccl_always_inline float4 interp(const TextureInfo &info, float x, float y)
static ccl_always_inline float4 read(float4 r)
static ccl_always_inline float4 interp_3d_linear(const TextureInfo &info, float x, float y, float z)
static ccl_always_inline float4 read(uint16_t r)
static ccl_always_inline float4 read(ushort4 r)
uint64_t data
Definition: util_texture.h:97
uint data_type
Definition: util_texture.h:99
uint use_transform_3d
Definition: util_texture.h:107
uint interpolation
Definition: util_texture.h:103
Transform transform_3d
Definition: util_texture.h:108
#define ccl_never_inline
Definition: util_defines.h:76
#define ccl_always_inline
Definition: util_defines.h:75
ccl_device_inline float4 half4_to_float4(half4 h)
Definition: util_half.h:129
ccl_device_inline float half_to_float(half h)
Definition: util_half.h:120
ccl_device_inline int float_to_int(float f)
Definition: util_math.h:321
ccl_device_inline int clamp(int a, int mn, int mx)
Definition: util_math.h:283
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
@ IMAGE_DATA_TYPE_BYTE
Definition: util_texture.h:56
@ IMAGE_DATA_TYPE_FLOAT
Definition: util_texture.h:55
@ IMAGE_DATA_TYPE_FLOAT4
Definition: util_texture.h:52
@ IMAGE_DATA_TYPE_USHORT4
Definition: util_texture.h:58
@ IMAGE_DATA_TYPE_USHORT
Definition: util_texture.h:59
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT
Definition: util_texture.h:60
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT3
Definition: util_texture.h:61
@ IMAGE_DATA_TYPE_HALF
Definition: util_texture.h:57
@ IMAGE_DATA_TYPE_BYTE4
Definition: util_texture.h:53
@ IMAGE_DATA_TYPE_HALF4
Definition: util_texture.h:54
#define TEX_IMAGE_MISSING_R
Definition: util_texture.h:28
#define TEX_IMAGE_MISSING_B
Definition: util_texture.h:30
InterpolationType
Definition: util_texture.h:38
@ INTERPOLATION_LINEAR
Definition: util_texture.h:40
@ INTERPOLATION_NONE
Definition: util_texture.h:39
@ INTERPOLATION_CLOSEST
Definition: util_texture.h:41
@ EXTENSION_REPEAT
Definition: util_texture.h:86
@ EXTENSION_CLIP
Definition: util_texture.h:90
@ EXTENSION_EXTEND
Definition: util_texture.h:88
#define TEX_IMAGE_MISSING_A
Definition: util_texture.h:31
#define TEX_IMAGE_MISSING_G
Definition: util_texture.h:29
ccl_device_inline float3 transform_point(const Transform *t, const float3 a)