Blender  V3.3
COM_OutputFileOperation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
5 
6 #include "BLI_listbase.h"
7 #include "BLI_path_util.h"
8 #include "BLI_string.h"
9 
10 #include "BKE_image.h"
11 #include "BKE_image_format.h"
12 #include "BKE_main.h"
13 #include "BKE_scene.h"
14 
15 #include "DNA_color_types.h"
16 
17 #include "IMB_colormanagement.h"
18 #include "IMB_imbuf.h"
19 #include "IMB_imbuf_types.h"
20 
21 #include "RE_pipeline.h"
22 
23 namespace blender::compositor {
24 
25 void add_exr_channels(void *exrhandle,
26  const char *layer_name,
27  const DataType datatype,
28  const char *view_name,
29  const size_t width,
30  bool use_half_float,
31  float *buf)
32 {
33  /* create channels */
34  switch (datatype) {
35  case DataType::Value:
37  exrhandle, layer_name, "V", view_name, 1, width, buf ? buf : nullptr, use_half_float);
38  break;
39  case DataType::Vector:
40  IMB_exr_add_channel(exrhandle,
41  layer_name,
42  "X",
43  view_name,
44  3,
45  3 * width,
46  buf ? buf : nullptr,
47  use_half_float);
48  IMB_exr_add_channel(exrhandle,
49  layer_name,
50  "Y",
51  view_name,
52  3,
53  3 * width,
54  buf ? buf + 1 : nullptr,
55  use_half_float);
56  IMB_exr_add_channel(exrhandle,
57  layer_name,
58  "Z",
59  view_name,
60  3,
61  3 * width,
62  buf ? buf + 2 : nullptr,
63  use_half_float);
64  break;
65  case DataType::Color:
66  IMB_exr_add_channel(exrhandle,
67  layer_name,
68  "R",
69  view_name,
70  4,
71  4 * width,
72  buf ? buf : nullptr,
73  use_half_float);
74  IMB_exr_add_channel(exrhandle,
75  layer_name,
76  "G",
77  view_name,
78  4,
79  4 * width,
80  buf ? buf + 1 : nullptr,
81  use_half_float);
82  IMB_exr_add_channel(exrhandle,
83  layer_name,
84  "B",
85  view_name,
86  4,
87  4 * width,
88  buf ? buf + 2 : nullptr,
89  use_half_float);
90  IMB_exr_add_channel(exrhandle,
91  layer_name,
92  "A",
93  view_name,
94  4,
95  4 * width,
96  buf ? buf + 3 : nullptr,
97  use_half_float);
98  break;
99  default:
100  break;
101  }
102 }
103 
104 void free_exr_channels(void *exrhandle,
105  const RenderData *rd,
106  const char *layer_name,
107  const DataType datatype)
108 {
109  SceneRenderView *srv;
110 
111  /* check renderdata for amount of views */
112  for (srv = (SceneRenderView *)rd->views.first; srv; srv = srv->next) {
113  float *rect = nullptr;
114 
115  if (BKE_scene_multiview_is_render_view_active(rd, srv) == false) {
116  continue;
117  }
118 
119  /* the pointer is stored in the first channel of each datatype */
120  switch (datatype) {
121  case DataType::Value:
122  rect = IMB_exr_channel_rect(exrhandle, layer_name, "V", srv->name);
123  break;
124  case DataType::Vector:
125  rect = IMB_exr_channel_rect(exrhandle, layer_name, "X", srv->name);
126  break;
127  case DataType::Color:
128  rect = IMB_exr_channel_rect(exrhandle, layer_name, "R", srv->name);
129  break;
130  default:
131  break;
132  }
133  if (rect) {
134  MEM_freeN(rect);
135  }
136  }
137 }
138 
140 {
141  switch (datatype) {
142  case DataType::Value:
143  return 1;
144  case DataType::Vector:
145  return 3;
146  case DataType::Color:
147  return 4;
148  default:
149  return 0;
150  }
151 }
152 
153 static float *init_buffer(unsigned int width, unsigned int height, DataType datatype)
154 {
155  /* When initializing the tree during initial load the width and height can be zero. */
156  if (width != 0 && height != 0) {
157  int size = get_datatype_size(datatype);
158  return (float *)MEM_callocN(width * height * size * sizeof(float), "OutputFile buffer");
159  }
160 
161  return nullptr;
162 }
163 
164 static void write_buffer_rect(rcti *rect,
165  const bNodeTree *tree,
166  SocketReader *reader,
167  float *buffer,
168  unsigned int width,
169  DataType datatype)
170 {
171  float color[4];
172  int i, size = get_datatype_size(datatype);
173 
174  if (!buffer) {
175  return;
176  }
177  int x1 = rect->xmin;
178  int y1 = rect->ymin;
179  int x2 = rect->xmax;
180  int y2 = rect->ymax;
181  int offset = (y1 * width + x1) * size;
182  int x;
183  int y;
184  bool breaked = false;
185 
186  for (y = y1; y < y2 && (!breaked); y++) {
187  for (x = x1; x < x2 && (!breaked); x++) {
189 
190  for (i = 0; i < size; i++) {
191  buffer[offset + i] = color[i];
192  }
193  offset += size;
194 
195  if (tree->test_break && tree->test_break(tree->tbh)) {
196  breaked = true;
197  }
198  }
199  offset += (width - (x2 - x1)) * size;
200  }
201 }
202 
204  const RenderData *rd,
205  const bNodeTree *tree,
206  DataType datatype,
207  const ImageFormatData *format,
208  const char *path,
209  const char *view_name,
210  const bool save_as_render)
211 {
212  rd_ = rd;
213  tree_ = tree;
214 
215  this->add_input_socket(datatype);
216 
217  output_buffer_ = nullptr;
218  datatype_ = datatype;
219  image_input_ = nullptr;
220 
222  if (!save_as_render) {
223  /* If not saving as render, stop IMB_colormanagement_imbuf_for_write using this
224  * colorspace for conversion. */
226  }
227 
228  BLI_strncpy(path_, path, sizeof(path_));
229 
230  view_name_ = view_name;
231  save_as_render_ = save_as_render;
232 }
233 
235 {
237 }
238 
240 {
243 }
244 
245 void OutputSingleLayerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/)
246 {
248 }
249 
251 {
252  if (this->get_width() * this->get_height() != 0) {
253 
255  ImBuf *ibuf = IMB_allocImBuf(this->get_width(), this->get_height(), format_.planes, 0);
256  char filename[FILE_MAX];
257  const char *suffix;
258 
259  ibuf->channels = size;
260  ibuf->rect_float = output_buffer_;
261  ibuf->mall |= IB_rectfloat;
262  ibuf->dither = rd_->dither_intensity;
263 
265 
267 
269  path_,
271  rd_->cfra,
272  &format_,
273  (rd_->scemode & R_EXTENSION) != 0,
274  true,
275  suffix);
276 
277  if (0 == BKE_imbuf_write(ibuf, filename, &format_)) {
278  printf("Cannot save Node File Output to %s\n", filename);
279  }
280  else {
281  printf("Saved: %s\n", filename);
282  }
283 
284  IMB_freeImBuf(ibuf);
285  }
286  output_buffer_ = nullptr;
287  image_input_ = nullptr;
288 }
289 
291  const rcti &area,
293 {
294  if (!output_buffer_) {
295  return;
296  }
297 
298  MemoryBuffer output_buf(output_buffer_,
300  this->get_width(),
301  this->get_height());
302  const MemoryBuffer *input_image = inputs[0];
303  output_buf.copy_from(input_image, area);
304 }
305 
306 /******************************* MultiLayer *******************************/
307 
308 OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_, bool use_layer_)
309 {
310  BLI_strncpy(this->name, name_, sizeof(this->name));
311  this->datatype = datatype_;
312  this->use_layer = use_layer_;
313 
314  /* these are created in init_execution */
315  this->output_buffer = nullptr;
316  this->image_input = nullptr;
317 }
318 
320  const RenderData *rd,
321  const bNodeTree *tree,
322  const char *path,
323  char exr_codec,
324  bool exr_half_float,
325  const char *view_name)
326 {
327  scene_ = scene;
328  rd_ = rd;
329  tree_ = tree;
330 
331  BLI_strncpy(path_, path, sizeof(path_));
332  exr_codec_ = exr_codec;
333  exr_half_float_ = exr_half_float;
334  view_name_ = view_name;
336 }
337 
339  DataType datatype,
340  bool use_layer)
341 {
342  this->add_input_socket(datatype);
343  layers_.append(OutputOpenExrLayer(name, datatype, use_layer));
344 }
345 
347 {
348  /* StampData API doesn't provide functions to modify an instance without having a RenderResult.
349  */
350  RenderResult render_result;
352  render_result.stamp_data = stamp_data;
353  for (const OutputOpenExrLayer &layer : layers_) {
354  /* Skip unconnected sockets. */
355  if (layer.image_input == nullptr) {
356  continue;
357  }
358  std::unique_ptr<MetaData> meta_data = layer.image_input->get_meta_data();
359  if (meta_data) {
360  blender::StringRef layer_name =
362  blender::StringRef(layer.name, BLI_strnlen(layer.name, sizeof(layer.name))));
363  meta_data->replace_hash_neutral_cryptomatte_keys(layer_name);
364  meta_data->add_to_render_result(&render_result);
365  }
366  }
367  return stamp_data;
368 }
369 
371 {
372  for (unsigned int i = 0; i < layers_.size(); i++) {
373  if (layers_[i].use_layer) {
375  layers_[i].image_input = reader;
376  layers_[i].output_buffer = init_buffer(
377  this->get_width(), this->get_height(), layers_[i].datatype);
378  }
379  }
380 }
381 
382 void OutputOpenExrMultiLayerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/)
383 {
384  for (unsigned int i = 0; i < layers_.size(); i++) {
385  OutputOpenExrLayer &layer = layers_[i];
386  if (layer.image_input) {
388  rect, tree_, layer.image_input, layer.output_buffer, this->get_width(), layer.datatype);
389  }
390  }
391 }
392 
394 {
395  unsigned int width = this->get_width();
396  unsigned int height = this->get_height();
397  if (width != 0 && height != 0) {
398  char filename[FILE_MAX];
399  const char *suffix;
400  void *exrhandle = IMB_exr_get_handle();
401 
404  path_,
406  rd_->cfra,
408  (rd_->scemode & R_EXTENSION) != 0,
409  true,
410  suffix);
411  BLI_make_existing_file(filename);
412 
413  for (unsigned int i = 0; i < layers_.size(); i++) {
414  OutputOpenExrLayer &layer = layers_[i];
415  if (!layer.image_input) {
416  continue; /* skip unconnected sockets */
417  }
418 
419  add_exr_channels(exrhandle,
420  layers_[i].name,
421  layers_[i].datatype,
422  "",
423  width,
425  layers_[i].output_buffer);
426  }
427 
428  /* when the filename has no permissions, this can fail */
429  StampData *stamp_data = create_stamp_data();
430  if (IMB_exr_begin_write(exrhandle, filename, width, height, exr_codec_, stamp_data)) {
431  IMB_exr_write_channels(exrhandle);
432  }
433  else {
434  /* TODO: get the error from openexr's exception. */
435  /* XXX: nice way to do report? */
436  printf("Error Writing Render Result, see console\n");
437  }
438 
439  IMB_exr_close(exrhandle);
440  for (unsigned int i = 0; i < layers_.size(); i++) {
441  if (layers_[i].output_buffer) {
442  MEM_freeN(layers_[i].output_buffer);
443  layers_[i].output_buffer = nullptr;
444  }
445 
446  layers_[i].image_input = nullptr;
447  }
448  BKE_stamp_data_free(stamp_data);
449  }
450 }
451 
453  const rcti &area,
455 {
456  const MemoryBuffer *input_image = inputs[0];
457  for (int i = 0; i < layers_.size(); i++) {
458  OutputOpenExrLayer &layer = layers_[i];
459  if (layer.output_buffer) {
460  MemoryBuffer output_buf(layer.output_buffer,
462  this->get_width(),
463  this->get_height());
464  output_buf.copy_from(input_image, area);
465  }
466  }
467 }
468 
469 } // namespace blender::compositor
void BKE_stamp_data_free(struct StampData *stamp_data)
int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, const struct ImageFormatData *imf)
struct StampData * BKE_stamp_info_from_scene_static(const struct Scene *scene)
void BKE_image_format_free(struct ImageFormatData *imf)
Definition: image_format.cc:52
void BKE_image_path_from_imformat(char *string, const char *base, const char *relbase, int frame, const struct ImageFormatData *im_format, bool use_ext, bool use_frames, const char *suffix)
void BKE_image_path_from_imtype(char *string, const char *base, const char *relbase, int frame, char imtype, bool use_ext, bool use_frames, const char *suffix)
void BKE_image_format_init_for_write(struct ImageFormatData *imf, const struct Scene *scene_src, const struct ImageFormatData *imf_src)
const char * BKE_main_blendfile_path_from_global(void)
Definition: main.c:562
bool BKE_scene_multiview_is_render_view_active(const struct RenderData *rd, const struct SceneRenderView *srv)
const char * BKE_scene_multiview_view_suffix_get(const struct RenderData *rd, const char *viewname)
bool BLI_make_existing_file(const char *name)
Definition: path_util.c:1197
#define FILE_MAX
size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:899
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNUSED(x)
#define R_EXTENSION
#define R_IMF_IMTYPE_MULTILAYER
_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 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
struct ImBuf * IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf, bool save_as_render, bool allocate_result, const struct ImageFormatData *image_format)
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
Definition: allocimbuf.c:500
Contains defines and structs used throughout the imbuf module.
@ IB_rectfloat
bool IMB_exr_begin_write(void *handle, const char *filepath, int width, int height, int compress, const struct StampData *stamp)
void IMB_exr_add_channel(void *handle, const char *layname, const char *passname, const char *view, int xstride, int ystride, float *rect, bool use_half_float)
void IMB_exr_close(void *handle)
void IMB_exr_write_channels(void *handle)
float * IMB_exr_channel_rect(void *handle, const char *layname, const char *passname, const char *view)
void * IMB_exr_get_handle(void)
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
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
a MemoryBuffer contains access to the data of a chunk
void copy_from(const MemoryBuffer *src, const rcti &area)
NodeOperation contains calculation logic.
SocketReader * get_input_socket_reader(unsigned int index)
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
OutputOpenExrMultiLayerOperation(const Scene *scene, const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, bool exr_half_float, const char *view_name)
void add_layer(const char *name, DataType datatype, bool use_layer)
void execute_region(rcti *rect, unsigned int tile_number) override
when a chunk is executed by a CPUDevice, this method is called
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
OutputSingleLayerOperation(const Scene *scene, const RenderData *rd, const bNodeTree *tree, DataType datatype, const ImageFormatData *format, const char *path, const char *view_name, bool save_as_render)
void execute_region(rcti *rect, unsigned int tile_number) override
when a chunk is executed by a CPUDevice, this method is called
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
Scene scene
void * tree
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
DataType
possible data types for sockets
Definition: COM_defines.h:30
@ Vector
Vector data type.
ccl_global float * buffer
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
format
Definition: logImageCore.h:38
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
StringRef BKE_cryptomatte_extract_layer_name(const StringRef render_pass_name)
Definition: cryptomatte.cc:475
static constexpr unsigned int RESOLUTION_INPUT_ANY
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void write_buffer_rect(rcti *rect, const bNodeTree *tree, SocketReader *reader, float *buffer, unsigned int width, DataType datatype)
void add_exr_channels(void *exrhandle, const char *layer_name, const DataType datatype, const char *view_name, const size_t width, bool use_half_float, float *buf)
static float * init_buffer(unsigned int width, unsigned int height, DataType datatype)
constexpr int COM_data_type_num_channels(const DataType datatype)
Definition: COM_defines.h:42
int get_datatype_size(DataType datatype)
void free_exr_channels(void *exrhandle, const RenderData *rd, const char *layer_name, const DataType datatype)
static bNodeSocketTemplate inputs[]
int channels
float dither
float * rect_float
ColorManagedColorspaceSettings linear_colorspace_settings
void * first
Definition: DNA_listBase.h:31
float dither_intensity
ListBase views
struct StampData * stamp_data
Definition: RE_pipeline.h:141
struct SceneRenderView * next
OutputOpenExrLayer(const char *name, DataType datatype, bool use_layer)
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