Blender  V3.3
COM_VariableSizeBokehBlurOperation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
5 #include "COM_OpenCLDevice.h"
6 
7 namespace blender::compositor {
8 
10 {
12  this->add_input_socket(DataType::Color, ResizeMode::Align); /* Do not resize the bokeh image. */
13  this->add_input_socket(DataType::Value); /* Radius. */
14 #ifdef COM_DEFOCUS_SEARCH
15  /* Inverse search radius optimization structure. */
17 #endif
19  flags_.complex = true;
20  flags_.open_cl = true;
21 
22  input_program_ = nullptr;
23  input_bokeh_program_ = nullptr;
24  input_size_program_ = nullptr;
25  max_blur_ = 32.0f;
26  threshold_ = 1.0f;
27  do_size_scale_ = false;
28 #ifdef COM_DEFOCUS_SEARCH
29  input_search_program_ = nullptr;
30 #endif
31 }
32 
34 {
35  input_program_ = get_input_socket_reader(0);
36  input_bokeh_program_ = get_input_socket_reader(1);
37  input_size_program_ = get_input_socket_reader(2);
38 #ifdef COM_DEFOCUS_SEARCH
39  input_search_program_ = get_input_socket_reader(3);
40 #endif
42 }
48 };
49 
51 {
53  data->color = (MemoryBuffer *)input_program_->initialize_tile_data(rect);
54  data->bokeh = (MemoryBuffer *)input_bokeh_program_->initialize_tile_data(rect);
55  data->size = (MemoryBuffer *)input_size_program_->initialize_tile_data(rect);
56 
57  rcti rect2 = COM_AREA_NONE;
59  rect, (ReadBufferOperation *)input_size_program_, &rect2);
60 
61  const float max_dim = MAX2(this->get_width(), this->get_height());
62  const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
63 
64  data->max_blur_scalar = (int)(data->size->get_max_value(rect2) * scalar);
65  CLAMP(data->max_blur_scalar, 1.0f, max_blur_);
66  return data;
67 }
68 
70 {
72  delete result;
73 }
74 
76 {
78  MemoryBuffer *input_program_buffer = tile_data->color;
79  MemoryBuffer *input_bokeh_buffer = tile_data->bokeh;
80  MemoryBuffer *input_size_buffer = tile_data->size;
81  float *input_size_float_buffer = input_size_buffer->get_buffer();
82  float *input_program_float_buffer = input_program_buffer->get_buffer();
83  float read_color[4];
84  float bokeh[4];
85  float temp_size[4];
86  float multiplier_accum[4];
87  float color_accum[4];
88 
89  const float max_dim = MAX2(get_width(), get_height());
90  const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
91  int max_blur_scalar = tile_data->max_blur_scalar;
92 
93  BLI_assert(input_bokeh_buffer->get_width() == COM_BLUR_BOKEH_PIXELS);
94  BLI_assert(input_bokeh_buffer->get_height() == COM_BLUR_BOKEH_PIXELS);
95 
96 #ifdef COM_DEFOCUS_SEARCH
97  float search[4];
98  input_search_program_->read(search,
99  x / InverseSearchRadiusOperation::DIVIDER,
100  y / InverseSearchRadiusOperation::DIVIDER,
101  nullptr);
102  int minx = search[0];
103  int miny = search[1];
104  int maxx = search[2];
105  int maxy = search[3];
106 #else
107  int minx = MAX2(x - max_blur_scalar, 0);
108  int miny = MAX2(y - max_blur_scalar, 0);
109  int maxx = MIN2(x + max_blur_scalar, (int)get_width());
110  int maxy = MIN2(y + max_blur_scalar, (int)get_height());
111 #endif
112  {
113  input_size_buffer->read_no_check(temp_size, x, y);
114  input_program_buffer->read_no_check(read_color, x, y);
115 
116  copy_v4_v4(color_accum, read_color);
117  copy_v4_fl(multiplier_accum, 1.0f);
118  float size_center = temp_size[0] * scalar;
119 
120  const int add_xstep_value = QualityStepHelper::get_step();
121  const int add_ystep_value = add_xstep_value;
122  const int add_xstep_color = add_xstep_value * COM_DATA_TYPE_COLOR_CHANNELS;
123 
124  if (size_center > threshold_) {
125  for (int ny = miny; ny < maxy; ny += add_ystep_value) {
126  float dy = ny - y;
127  int offset_value_ny = ny * input_size_buffer->get_width();
128  int offset_value_nx_ny = offset_value_ny + (minx);
129  int offset_color_nx_ny = offset_value_nx_ny * COM_DATA_TYPE_COLOR_CHANNELS;
130  for (int nx = minx; nx < maxx; nx += add_xstep_value) {
131  if (nx != x || ny != y) {
132  float size = MIN2(input_size_float_buffer[offset_value_nx_ny] * scalar, size_center);
133  if (size > threshold_) {
134  float dx = nx - x;
135  if (size > fabsf(dx) && size > fabsf(dy)) {
136  float uv[2] = {
138  (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1),
140  (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1),
141  };
142  input_bokeh_buffer->read(bokeh, uv[0], uv[1]);
143  madd_v4_v4v4(color_accum, bokeh, &input_program_float_buffer[offset_color_nx_ny]);
144  add_v4_v4(multiplier_accum, bokeh);
145  }
146  }
147  }
148  offset_color_nx_ny += add_xstep_color;
149  offset_value_nx_ny += add_xstep_value;
150  }
151  }
152  }
153 
154  output[0] = color_accum[0] / multiplier_accum[0];
155  output[1] = color_accum[1] / multiplier_accum[1];
156  output[2] = color_accum[2] / multiplier_accum[2];
157  output[3] = color_accum[3] / multiplier_accum[3];
158 
159  /* blend in out values over the threshold, otherwise we get sharp, ugly transitions */
160  if ((size_center > threshold_) && (size_center < threshold_ * 2.0f)) {
161  /* factor from 0-1 */
162  float fac = (size_center - threshold_) / threshold_;
163  interp_v4_v4v4(output, read_color, output, fac);
164  }
165  }
166 }
167 
169  OpenCLDevice *device,
170  MemoryBuffer *output_memory_buffer,
171  cl_mem cl_output_buffer,
172  MemoryBuffer **input_memory_buffers,
173  std::list<cl_mem> *cl_mem_to_clean_up,
174  std::list<cl_kernel> * /*cl_kernels_to_clean_up*/)
175 {
176  cl_kernel defocus_kernel = device->COM_cl_create_kernel("defocus_kernel", nullptr);
177 
178  cl_int step = this->get_step();
179  cl_int max_blur;
180  cl_float threshold = threshold_;
181 
182  MemoryBuffer *size_memory_buffer = input_size_program_->get_input_memory_buffer(
183  input_memory_buffers);
184 
185  const float max_dim = MAX2(get_width(), get_height());
186  cl_float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
187 
188  max_blur = (cl_int)min_ff(size_memory_buffer->get_max_value() * scalar, (float)max_blur_);
189 
191  defocus_kernel, 0, -1, cl_mem_to_clean_up, input_memory_buffers, input_program_);
193  defocus_kernel, 1, -1, cl_mem_to_clean_up, input_memory_buffers, input_bokeh_program_);
195  defocus_kernel, 2, 4, cl_mem_to_clean_up, input_memory_buffers, input_size_program_);
197  defocus_kernel, 3, cl_output_buffer);
199  defocus_kernel, 5, output_memory_buffer);
200  clSetKernelArg(defocus_kernel, 6, sizeof(cl_int), &step);
201  clSetKernelArg(defocus_kernel, 7, sizeof(cl_int), &max_blur);
202  clSetKernelArg(defocus_kernel, 8, sizeof(cl_float), &threshold);
203  clSetKernelArg(defocus_kernel, 9, sizeof(cl_float), &scalar);
204  device->COM_cl_attach_size_to_kernel_parameter(defocus_kernel, 10, this);
205 
206  device->COM_cl_enqueue_range(defocus_kernel, output_memory_buffer, 11, this);
207 }
208 
210 {
211  input_program_ = nullptr;
212  input_bokeh_program_ = nullptr;
213  input_size_program_ = nullptr;
214 #ifdef COM_DEFOCUS_SEARCH
215  input_search_program_ = nullptr;
216 #endif
217 }
218 
220  rcti *input, ReadBufferOperation *read_operation, rcti *output)
221 {
222  rcti new_input;
223  rcti bokeh_input;
224 
225  const float max_dim = MAX2(get_width(), get_height());
226  const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
227  int max_blur_scalar = max_blur_ * scalar;
228 
229  new_input.xmax = input->xmax + max_blur_scalar + 2;
230  new_input.xmin = input->xmin - max_blur_scalar + 2;
231  new_input.ymax = input->ymax + max_blur_scalar - 2;
232  new_input.ymin = input->ymin - max_blur_scalar - 2;
233  bokeh_input.xmax = COM_BLUR_BOKEH_PIXELS;
234  bokeh_input.xmin = 0;
235  bokeh_input.ymax = COM_BLUR_BOKEH_PIXELS;
236  bokeh_input.ymin = 0;
237 
238  NodeOperation *operation = get_input_operation(2);
239  if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) {
240  return true;
241  }
242  operation = get_input_operation(1);
243  if (operation->determine_depending_area_of_interest(&bokeh_input, read_operation, output)) {
244  return true;
245  }
246 #ifdef COM_DEFOCUS_SEARCH
247  rcti search_input;
248  search_input.xmax = (input->xmax / InverseSearchRadiusOperation::DIVIDER) + 1;
249  search_input.xmin = (input->xmin / InverseSearchRadiusOperation::DIVIDER) - 1;
250  search_input.ymax = (input->ymax / InverseSearchRadiusOperation::DIVIDER) + 1;
251  search_input.ymin = (input->ymin / InverseSearchRadiusOperation::DIVIDER) - 1;
252  operation = get_input_operation(3);
253  if (operation->determine_depending_area_of_interest(&search_input, read_operation, output)) {
254  return true;
255  }
256 #endif
257  operation = get_input_operation(0);
258  if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) {
259  return true;
260  }
261  return false;
262 }
263 
265  const rcti &output_area,
266  rcti &r_input_area)
267 {
268  switch (input_idx) {
269  case IMAGE_INPUT_INDEX:
270  case SIZE_INPUT_INDEX: {
271  const float max_dim = MAX2(get_width(), get_height());
272  const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
273  const int max_blur_scalar = max_blur_ * scalar;
274  r_input_area.xmax = output_area.xmax + max_blur_scalar + 2;
275  r_input_area.xmin = output_area.xmin - max_blur_scalar - 2;
276  r_input_area.ymax = output_area.ymax + max_blur_scalar + 2;
277  r_input_area.ymin = output_area.ymin - max_blur_scalar - 2;
278  break;
279  }
280  case BOKEH_INPUT_INDEX: {
281  r_input_area = output_area;
282  r_input_area.xmax = r_input_area.xmin + COM_BLUR_BOKEH_PIXELS;
283  r_input_area.ymax = r_input_area.ymin + COM_BLUR_BOKEH_PIXELS;
284  break;
285  }
286 #ifdef COM_DEFOCUS_SEARCH
287  case DEFOCUS_INPUT_INDEX: {
288  r_input_area.xmax = (output_area.xmax / InverseSearchRadiusOperation::DIVIDER) + 1;
289  r_input_area.xmin = (output_area.xmin / InverseSearchRadiusOperation::DIVIDER) - 1;
290  r_input_area.ymax = (output_area.ymax / InverseSearchRadiusOperation::DIVIDER) + 1;
291  r_input_area.ymin = (output_area.ymin / InverseSearchRadiusOperation::DIVIDER) - 1;
292  break;
293  }
294 #endif
295  }
296 }
297 
298 struct PixelData {
300  float color_accum[4];
301  float threshold;
302  float scalar;
303  float size_center;
305  int step;
311 };
312 
313 static void blur_pixel(int x, int y, PixelData &p)
314 {
317 
318 #ifdef COM_DEFOCUS_SEARCH
319  float search[4];
320  inputs[DEFOCUS_INPUT_INDEX]->read_elem_checked(x / InverseSearchRadiusOperation::DIVIDER,
321  y / InverseSearchRadiusOperation::DIVIDER,
322  search);
323  const int minx = search[0];
324  const int miny = search[1];
325  const int maxx = search[2];
326  const int maxy = search[3];
327 #else
328  const int minx = MAX2(x - p.max_blur_scalar, 0);
329  const int miny = MAX2(y - p.max_blur_scalar, 0);
330  const int maxx = MIN2(x + p.max_blur_scalar, p.image_width);
331  const int maxy = MIN2(y + p.max_blur_scalar, p.image_height);
332 #endif
333 
334  const int color_row_stride = p.image_input->row_stride * p.step;
335  const int color_elem_stride = p.image_input->elem_stride * p.step;
336  const int size_row_stride = p.size_input->row_stride * p.step;
337  const int size_elem_stride = p.size_input->elem_stride * p.step;
338  const float *row_color = p.image_input->get_elem(minx, miny);
339  const float *row_size = p.size_input->get_elem(minx, miny);
340  for (int ny = miny; ny < maxy;
341  ny += p.step, row_size += size_row_stride, row_color += color_row_stride) {
342  const float dy = ny - y;
343  const float *size_elem = row_size;
344  const float *color = row_color;
345  for (int nx = minx; nx < maxx;
346  nx += p.step, size_elem += size_elem_stride, color += color_elem_stride) {
347  if (nx == x && ny == y) {
348  continue;
349  }
350  const float size = MIN2(size_elem[0] * p.scalar, p.size_center);
351  if (size <= p.threshold) {
352  continue;
353  }
354  const float dx = nx - x;
355  if (size <= fabsf(dx) || size <= fabsf(dy)) {
356  continue;
357  }
358 
359  /* XXX: There is no way to ensure bokeh input is an actual bokeh with #COM_BLUR_BOKEH_PIXELS
360  * size, anything may be connected. Use the real input size and remove asserts? */
361  const float u = (float)(COM_BLUR_BOKEH_PIXELS / 2) +
362  (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1);
363  const float v = (float)(COM_BLUR_BOKEH_PIXELS / 2) +
364  (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1);
365  float bokeh[4];
366  p.bokeh_input->read_elem_checked(u, v, bokeh);
367  madd_v4_v4v4(p.color_accum, bokeh, color);
368  add_v4_v4(p.multiplier_accum, bokeh);
369  }
370  }
371 }
372 
374  const rcti &area,
376 {
377  PixelData p;
378  p.bokeh_input = inputs[BOKEH_INPUT_INDEX];
379  p.size_input = inputs[SIZE_INPUT_INDEX];
380  p.image_input = inputs[IMAGE_INPUT_INDEX];
382  p.threshold = threshold_;
383  p.image_width = this->get_width();
384  p.image_height = this->get_height();
385 
386  rcti scalar_area = COM_AREA_NONE;
387  this->get_area_of_interest(SIZE_INPUT_INDEX, area, scalar_area);
388  BLI_rcti_isect(&scalar_area, &p.size_input->get_rect(), &scalar_area);
389  const float max_size = p.size_input->get_max_value(scalar_area);
390 
391  const float max_dim = MAX2(this->get_width(), this->get_height());
392  p.scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
393  p.max_blur_scalar = static_cast<int>(max_size * p.scalar);
394  CLAMP(p.max_blur_scalar, 1, max_blur_);
395 
396  for (BuffersIterator<float> it = output->iterate_with({p.image_input, p.size_input}, area);
397  !it.is_end();
398  ++it) {
399  const float *color = it.in(0);
400  const float size = *it.in(1);
402  copy_v4_fl(p.multiplier_accum, 1.0f);
403  p.size_center = size * p.scalar;
404 
405  if (p.size_center > p.threshold) {
406  blur_pixel(it.x, it.y, p);
407  }
408 
409  it.out[0] = p.color_accum[0] / p.multiplier_accum[0];
410  it.out[1] = p.color_accum[1] / p.multiplier_accum[1];
411  it.out[2] = p.color_accum[2] / p.multiplier_accum[2];
412  it.out[3] = p.color_accum[3] / p.multiplier_accum[3];
413 
414  /* Blend in out values over the threshold, otherwise we get sharp, ugly transitions. */
415  if ((p.size_center > p.threshold) && (p.size_center < p.threshold * 2.0f)) {
416  /* Factor from 0-1. */
417  const float fac = (p.size_center - p.threshold) / p.threshold;
418  interp_v4_v4v4(it.out, color, it.out, fac);
419  }
420  }
421 }
422 
423 #ifdef COM_DEFOCUS_SEARCH
424 /* #InverseSearchRadiusOperation. */
425 InverseSearchRadiusOperation::InverseSearchRadiusOperation()
426 {
427  this->add_input_socket(DataType::Value, ResizeMode::Align); /* Radius. */
428  this->add_output_socket(DataType::Color);
429  this->flags.complex = true;
430  input_radius_ = nullptr;
431 }
432 
434 {
435  input_radius_ = this->get_input_socket_reader(0);
436 }
437 
438 void *InverseSearchRadiusOperation::initialize_tile_data(rcti *rect)
439 {
440  MemoryBuffer *data = new MemoryBuffer(DataType::Color, rect);
441  float *buffer = data->get_buffer();
442  int x, y;
443  int width = input_radius_->get_width();
444  int height = input_radius_->get_height();
445  float temp[4];
446  int offset = 0;
447  for (y = rect->ymin; y < rect->ymax; y++) {
448  for (x = rect->xmin; x < rect->xmax; x++) {
449  int rx = x * DIVIDER;
450  int ry = y * DIVIDER;
451  buffer[offset] = MAX2(rx - max_blur_, 0);
452  buffer[offset + 1] = MAX2(ry - max_blur_, 0);
453  buffer[offset + 2] = MIN2(rx + DIVIDER + max_blur_, width);
454  buffer[offset + 3] = MIN2(ry + DIVIDER + max_blur_, height);
455  offset += 4;
456  }
457  }
458 # if 0
459  for (x = rect->xmin; x < rect->xmax; x++) {
460  for (y = rect->ymin; y < rect->ymax; y++) {
461  int rx = x * DIVIDER;
462  int ry = y * DIVIDER;
463  float radius = 0.0f;
464  float maxx = x;
465  float maxy = y;
466 
467  for (int x2 = 0; x2 < DIVIDER; x2++) {
468  for (int y2 = 0; y2 < DIVIDER; y2++) {
469  input_radius_->read(temp, rx + x2, ry + y2, PixelSampler::Nearest);
470  if (radius < temp[0]) {
471  radius = temp[0];
472  maxx = x2;
473  maxy = y2;
474  }
475  }
476  }
477  int impact_radius = ceil(radius / DIVIDER);
478  for (int x2 = x - impact_radius; x2 < x + impact_radius; x2++) {
479  for (int y2 = y - impact_radius; y2 < y + impact_radius; y2++) {
480  data->read(temp, x2, y2);
481  temp[0] = MIN2(temp[0], maxx);
482  temp[1] = MIN2(temp[1], maxy);
483  temp[2] = MAX2(temp[2], maxx);
484  temp[3] = MAX2(temp[3], maxy);
485  data->write_pixel(x2, y2, temp);
486  }
487  }
488  }
489  }
490 # endif
491  return data;
492 }
493 
494 void InverseSearchRadiusOperation::execute_pixel_chunk(float output[4], int x, int y, void *data)
495 {
496  MemoryBuffer *buffer = (MemoryBuffer *)data;
497  buffer->read_no_check(output, x, y);
498 }
499 
500 void InverseSearchRadiusOperation::deinitialize_tile_data(rcti *rect, void *data)
501 {
502  if (data) {
503  MemoryBuffer *mb = (MemoryBuffer *)data;
504  delete mb;
505  }
506 }
507 
508 void InverseSearchRadiusOperation::deinit_execution()
509 {
510  input_radius_ = nullptr;
511 }
512 
513 void InverseSearchRadiusOperation::determine_resolution(unsigned int resolution[2],
514  unsigned int preferred_resolution[2])
515 {
516  NodeOperation::determine_resolution(resolution, preferred_resolution);
517  resolution[0] = resolution[0] / DIVIDER;
518  resolution[1] = resolution[1] / DIVIDER;
519 }
520 
521 bool InverseSearchRadiusOperation::determine_depending_area_of_interest(
522  rcti *input, ReadBufferOperation *read_operation, rcti *output)
523 {
524  rcti new_rect;
525  new_rect.ymin = input->ymin * DIVIDER - max_blur_;
526  new_rect.ymax = input->ymax * DIVIDER + max_blur_;
527  new_rect.xmin = input->xmin * DIVIDER - max_blur_;
528  new_rect.xmax = input->xmax * DIVIDER + max_blur_;
529  return NodeOperation::determine_depending_area_of_interest(&new_rect, read_operation, output);
530 }
531 #endif
532 
533 } // namespace blender::compositor
typedef float(TangentPoint)[2]
#define BLI_assert(a)
Definition: BLI_assert.h:46
MINLINE float min_ff(float a, float b)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void madd_v4_v4v4(float r[4], const float a[4], const float b[4])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t)
Definition: math_vector.c:38
MINLINE void copy_v4_fl(float r[4], float f)
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
#define MAX2(a, b)
#define MIN2(a, b)
_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 ny
_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
_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 x2
_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
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
a MemoryBuffer contains access to the data of a chunk
void read(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
void read_elem_checked(int x, int y, float *out) const
const rcti & get_rect() const
get the rect of this MemoryBuffer
const int get_width() const
get the width of this MemoryBuffer
const int get_height() const
get the height of this MemoryBuffer
float * get_buffer()
get the data of this MemoryBuffer
void read_no_check(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
NodeOperation contains calculation logic.
void add_output_socket(DataType datatype)
SocketReader * get_input_socket_reader(unsigned int index)
virtual MemoryBuffer * get_input_memory_buffer(MemoryBuffer **)
NodeOperation * get_input_operation(int index)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
virtual void * initialize_tile_data(rcti *)
device representing an GPU OpenCL device. an instance of this class represents a single cl_device
void COM_cl_attach_size_to_kernel_parameter(cl_kernel kernel, int offset_index, NodeOperation *operation)
cl_mem COM_cl_attach_memory_buffer_to_kernel_parameter(cl_kernel kernel, int parameter_index, int offset_index, std::list< cl_mem > *cleanup, MemoryBuffer **input_memory_buffers, SocketReader *reader)
void COM_cl_attach_output_memory_buffer_to_kernel_parameter(cl_kernel kernel, int parameter_index, cl_mem cl_output_memory_buffer)
void COM_cl_enqueue_range(cl_kernel kernel, MemoryBuffer *output_memory_buffer)
cl_kernel COM_cl_create_kernel(const char *kernelname, std::list< cl_kernel > *cl_kernels_to_clean_up)
void COM_cl_attach_memory_buffer_offset_to_kernel_parameter(cl_kernel kernel, int offset_index, MemoryBuffer *memory_buffers)
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
void execute_opencl(OpenCLDevice *device, MemoryBuffer *output_memory_buffer, cl_mem cl_output_buffer, MemoryBuffer **input_memory_buffers, std::list< cl_mem > *cl_mem_to_clean_up, std::list< cl_kernel > *cl_kernels_to_clean_up) override
custom handle to add new tasks to the OpenCL command queue in order to execute a chunk on an GPUDevic...
void execute_pixel(float output[4], int x, int y, void *data) override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
static struct ImBuf * init_execution(const SeqRenderData *context, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
Definition: effects.c:3519
ccl_global float * buffer
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_global KernelShaderEvalInput * input
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
#define fabsf(x)
Definition: metal/compat.h:219
static void area(int d1, int d2, int e1, int e2, float weights[2])
constexpr int COM_DATA_TYPE_COLOR_CHANNELS
Definition: COM_defines.h:62
static void blur_pixel(PixelCursor &p)
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
constexpr float COM_BLUR_BOKEH_PIXELS
Definition: COM_defines.h:110
constexpr rcti COM_AREA_NONE
Definition: COM_defines.h:112
static bNodeSocketTemplate inputs[]
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63