Blender  V2.93
geom_triangle.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 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 /* Triangle Primitive
18  *
19  * Basic triangle with 3 vertices is used to represent mesh surfaces. For BVH
20  * ray intersection we use a precomputed triangle storage to accelerate
21  * intersection at the cost of more memory usage */
22 
24 
25 /* normal on triangle */
27 {
28  /* load triangle vertices */
29  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim);
30  const float3 v0 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
31  const float3 v1 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
32  const float3 v2 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
33 
34  /* return normal */
35  if (sd->object_flag & SD_OBJECT_NEGATIVE_SCALE_APPLIED) {
36  return normalize(cross(v2 - v0, v1 - v0));
37  }
38  else {
39  return normalize(cross(v1 - v0, v2 - v0));
40  }
41 }
42 
43 /* point and normal on triangle */
45  KernelGlobals *kg, int object, int prim, float u, float v, float3 *P, float3 *Ng, int *shader)
46 {
47  /* load triangle vertices */
48  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
49  float3 v0 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
50  float3 v1 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
51  float3 v2 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
52  /* compute point */
53  float t = 1.0f - u - v;
54  *P = (u * v0 + v * v1 + t * v2);
55  /* get object flags */
56  int object_flag = kernel_tex_fetch(__object_flag, object);
57  /* compute normal */
58  if (object_flag & SD_OBJECT_NEGATIVE_SCALE_APPLIED) {
59  *Ng = normalize(cross(v2 - v0, v1 - v0));
60  }
61  else {
62  *Ng = normalize(cross(v1 - v0, v2 - v0));
63  }
64  /* shader`*/
65  *shader = kernel_tex_fetch(__tri_shader, prim);
66 }
67 
68 /* Triangle vertex locations */
69 
70 ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3])
71 {
72  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
73  P[0] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
74  P[1] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
75  P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
76 }
77 
78 /* Interpolate smooth vertex normal from vertices */
79 
81 triangle_smooth_normal(KernelGlobals *kg, float3 Ng, int prim, float u, float v)
82 {
83  /* load triangle vertices */
84  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
85  float3 n0 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.x));
86  float3 n1 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.y));
87  float3 n2 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.z));
88 
89  float3 N = safe_normalize((1.0f - u - v) * n2 + u * n0 + v * n1);
90 
91  return is_zero(N) ? Ng : N;
92 }
93 
94 /* Ray differentials on triangle */
95 
96 ccl_device_inline void triangle_dPdudv(KernelGlobals *kg,
97  int prim,
98  ccl_addr_space float3 *dPdu,
99  ccl_addr_space float3 *dPdv)
100 {
101  /* fetch triangle vertex coordinates */
102  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
103  const float3 p0 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
104  const float3 p1 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
105  const float3 p2 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
106 
107  /* compute derivatives of P w.r.t. uv */
108  *dPdu = (p0 - p2);
109  *dPdv = (p1 - p2);
110 }
111 
112 /* Reading attributes on various triangle elements */
113 
115  KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float *dx, float *dy)
116 {
118  float f0, f1, f2;
119 
121  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim);
122  f0 = kernel_tex_fetch(__attributes_float, desc.offset + tri_vindex.x);
123  f1 = kernel_tex_fetch(__attributes_float, desc.offset + tri_vindex.y);
124  f2 = kernel_tex_fetch(__attributes_float, desc.offset + tri_vindex.z);
125  }
126  else {
127  const int tri = desc.offset + sd->prim * 3;
128  f0 = kernel_tex_fetch(__attributes_float, tri + 0);
129  f1 = kernel_tex_fetch(__attributes_float, tri + 1);
130  f2 = kernel_tex_fetch(__attributes_float, tri + 2);
131  }
132 
133 #ifdef __RAY_DIFFERENTIALS__
134  if (dx)
135  *dx = sd->du.dx * f0 + sd->dv.dx * f1 - (sd->du.dx + sd->dv.dx) * f2;
136  if (dy)
137  *dy = sd->du.dy * f0 + sd->dv.dy * f1 - (sd->du.dy + sd->dv.dy) * f2;
138 #endif
139 
140  return sd->u * f0 + sd->v * f1 + (1.0f - sd->u - sd->v) * f2;
141  }
142  else {
143 #ifdef __RAY_DIFFERENTIALS__
144  if (dx)
145  *dx = 0.0f;
146  if (dy)
147  *dy = 0.0f;
148 #endif
149 
151  const int offset = (desc.element == ATTR_ELEMENT_FACE) ? desc.offset + sd->prim :
152  desc.offset;
153  return kernel_tex_fetch(__attributes_float, offset);
154  }
155  else {
156  return 0.0f;
157  }
158  }
159 }
160 
162  const ShaderData *sd,
163  const AttributeDescriptor desc,
164  float2 *dx,
165  float2 *dy)
166 {
168  float2 f0, f1, f2;
169 
171  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim);
172  f0 = kernel_tex_fetch(__attributes_float2, desc.offset + tri_vindex.x);
173  f1 = kernel_tex_fetch(__attributes_float2, desc.offset + tri_vindex.y);
174  f2 = kernel_tex_fetch(__attributes_float2, desc.offset + tri_vindex.z);
175  }
176  else {
177  const int tri = desc.offset + sd->prim * 3;
178  f0 = kernel_tex_fetch(__attributes_float2, tri + 0);
179  f1 = kernel_tex_fetch(__attributes_float2, tri + 1);
180  f2 = kernel_tex_fetch(__attributes_float2, tri + 2);
181  }
182 
183 #ifdef __RAY_DIFFERENTIALS__
184  if (dx)
185  *dx = sd->du.dx * f0 + sd->dv.dx * f1 - (sd->du.dx + sd->dv.dx) * f2;
186  if (dy)
187  *dy = sd->du.dy * f0 + sd->dv.dy * f1 - (sd->du.dy + sd->dv.dy) * f2;
188 #endif
189 
190  return sd->u * f0 + sd->v * f1 + (1.0f - sd->u - sd->v) * f2;
191  }
192  else {
193 #ifdef __RAY_DIFFERENTIALS__
194  if (dx)
195  *dx = make_float2(0.0f, 0.0f);
196  if (dy)
197  *dy = make_float2(0.0f, 0.0f);
198 #endif
199 
201  const int offset = (desc.element == ATTR_ELEMENT_FACE) ? desc.offset + sd->prim :
202  desc.offset;
203  return kernel_tex_fetch(__attributes_float2, offset);
204  }
205  else {
206  return make_float2(0.0f, 0.0f);
207  }
208  }
209 }
210 
212  const ShaderData *sd,
213  const AttributeDescriptor desc,
214  float3 *dx,
215  float3 *dy)
216 {
218  float3 f0, f1, f2;
219 
221  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim);
222  f0 = float4_to_float3(kernel_tex_fetch(__attributes_float3, desc.offset + tri_vindex.x));
223  f1 = float4_to_float3(kernel_tex_fetch(__attributes_float3, desc.offset + tri_vindex.y));
224  f2 = float4_to_float3(kernel_tex_fetch(__attributes_float3, desc.offset + tri_vindex.z));
225  }
226  else {
227  const int tri = desc.offset + sd->prim * 3;
228  f0 = float4_to_float3(kernel_tex_fetch(__attributes_float3, tri + 0));
229  f1 = float4_to_float3(kernel_tex_fetch(__attributes_float3, tri + 1));
230  f2 = float4_to_float3(kernel_tex_fetch(__attributes_float3, tri + 2));
231  }
232 
233 #ifdef __RAY_DIFFERENTIALS__
234  if (dx)
235  *dx = sd->du.dx * f0 + sd->dv.dx * f1 - (sd->du.dx + sd->dv.dx) * f2;
236  if (dy)
237  *dy = sd->du.dy * f0 + sd->dv.dy * f1 - (sd->du.dy + sd->dv.dy) * f2;
238 #endif
239 
240  return sd->u * f0 + sd->v * f1 + (1.0f - sd->u - sd->v) * f2;
241  }
242  else {
243 #ifdef __RAY_DIFFERENTIALS__
244  if (dx)
245  *dx = make_float3(0.0f, 0.0f, 0.0f);
246  if (dy)
247  *dy = make_float3(0.0f, 0.0f, 0.0f);
248 #endif
249 
251  const int offset = (desc.element == ATTR_ELEMENT_FACE) ? desc.offset + sd->prim :
252  desc.offset;
253  return float4_to_float3(kernel_tex_fetch(__attributes_float3, offset));
254  }
255  else {
256  return make_float3(0.0f, 0.0f, 0.0f);
257  }
258  }
259 }
260 
262  const ShaderData *sd,
263  const AttributeDescriptor desc,
264  float4 *dx,
265  float4 *dy)
266 {
269  float4 f0, f1, f2;
270 
272  const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim);
273  f0 = kernel_tex_fetch(__attributes_float3, desc.offset + tri_vindex.x);
274  f1 = kernel_tex_fetch(__attributes_float3, desc.offset + tri_vindex.y);
275  f2 = kernel_tex_fetch(__attributes_float3, desc.offset + tri_vindex.z);
276  }
277  else {
278  const int tri = desc.offset + sd->prim * 3;
279  if (desc.element == ATTR_ELEMENT_CORNER) {
280  f0 = kernel_tex_fetch(__attributes_float3, tri + 0);
281  f1 = kernel_tex_fetch(__attributes_float3, tri + 1);
282  f2 = kernel_tex_fetch(__attributes_float3, tri + 2);
283  }
284  else {
286  color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, tri + 0)));
288  color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, tri + 1)));
290  color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, tri + 2)));
291  }
292  }
293 
294 #ifdef __RAY_DIFFERENTIALS__
295  if (dx)
296  *dx = sd->du.dx * f0 + sd->dv.dx * f1 - (sd->du.dx + sd->dv.dx) * f2;
297  if (dy)
298  *dy = sd->du.dy * f0 + sd->dv.dy * f1 - (sd->du.dy + sd->dv.dy) * f2;
299 #endif
300 
301  return sd->u * f0 + sd->v * f1 + (1.0f - sd->u - sd->v) * f2;
302  }
303  else {
304 #ifdef __RAY_DIFFERENTIALS__
305  if (dx)
306  *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
307  if (dy)
308  *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
309 #endif
310 
312  const int offset = (desc.element == ATTR_ELEMENT_FACE) ? desc.offset + sd->prim :
313  desc.offset;
314  return kernel_tex_fetch(__attributes_float3, offset);
315  }
316  else {
317  return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
318  }
319  }
320 }
321 
_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
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
ccl_device float triangle_attribute_float(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float *dx, float *dy)
ccl_device float2 triangle_attribute_float2(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float2 *dx, float2 *dy)
ccl_device_inline void triangle_dPdudv(KernelGlobals *kg, int prim, ccl_addr_space float3 *dPdu, ccl_addr_space float3 *dPdv)
Definition: geom_triangle.h:96
CCL_NAMESPACE_BEGIN ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
Definition: geom_triangle.h:26
ccl_device float3 triangle_attribute_float3(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float3 *dx, float3 *dy)
ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3])
Definition: geom_triangle.h:70
ccl_device_inline void triangle_point_normal(KernelGlobals *kg, int object, int prim, float u, float v, float3 *P, float3 *Ng, int *shader)
Definition: geom_triangle.h:44
ccl_device_inline float3 triangle_smooth_normal(KernelGlobals *kg, float3 Ng, int prim, float u, float v)
Definition: geom_triangle.h:81
ccl_device float4 triangle_attribute_float4(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float4 *dx, float4 *dy)
#define ccl_addr_space
#define kernel_tex_fetch(tex, index)
#define ccl_device
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define make_float2(x, y)
#define make_float4(x, y, z, w)
#define make_float3(x, y, z)
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)
ShaderData
@ SD_OBJECT_NEGATIVE_SCALE_APPLIED
Definition: kernel_types.h:910
@ ATTR_ELEMENT_CORNER_BYTE
Definition: kernel_types.h:737
@ ATTR_ELEMENT_CORNER
Definition: kernel_types.h:736
@ ATTR_ELEMENT_OBJECT
Definition: kernel_types.h:731
@ ATTR_ELEMENT_VERTEX_MOTION
Definition: kernel_types.h:735
@ ATTR_ELEMENT_VERTEX
Definition: kernel_types.h:734
@ ATTR_ELEMENT_FACE
Definition: kernel_types.h:733
@ ATTR_ELEMENT_MESH
Definition: kernel_types.h:732
static float P(float k)
Definition: math_interp.c:41
params N
AttributeElement element
Definition: kernel_types.h:782
__forceinline avxf cross(const avxf &a, const avxf &b)
Definition: util_avxf.h:119
ccl_device_inline float4 color_uchar4_to_float4(uchar4 c)
Definition: util_color.h:63
ccl_device float4 color_srgb_to_linear_v4(float4 c)
Definition: util_color.h:263
ccl_device_inline float3 float4_to_float3(const float4 a)
Definition: util_math.h:415
ccl_device_inline float2 normalize(const float2 &a)
ccl_device_inline float2 safe_normalize(const float2 &a)
ccl_device_inline bool is_zero(const float2 &a)