Blender  V3.3
session/output_driver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2021-2022 Blender Foundation */
3 
4 #pragma once
5 
6 #include "util/math.h"
7 #include "util/string.h"
8 #include "util/types.h"
9 
11 
12 /* Output driver for reading render buffers.
13  *
14  * Host applications implement this interface for outputting render buffers for offline rendering.
15  * Drivers can be used to copy the buffers into the host application or write them directly to
16  * disk. This interface may also be used for interactive display, however the DisplayDriver is more
17  * efficient for that purpose.
18  */
19 class OutputDriver {
20  public:
21  OutputDriver() = default;
22  virtual ~OutputDriver() = default;
23 
24  class Tile {
25  public:
26  Tile(const int2 offset,
27  const int2 size,
28  const int2 full_size,
29  const string_view layer,
30  const string_view view)
32  {
33  }
34  virtual ~Tile() = default;
35 
36  const int2 offset;
37  const int2 size;
38  const int2 full_size;
39  const string layer;
40  const string view;
41 
42  virtual bool get_pass_pixels(const string_view pass_name,
43  const int num_channels,
44  float *pixels) const = 0;
45  virtual bool set_pass_pixels(const string_view pass_name,
46  const int num_channels,
47  const float *pixels) const = 0;
48  };
49 
50  /* Write tile once it has finished rendering. */
51  virtual void write_render_tile(const Tile &tile) = 0;
52 
53  /* Update tile while rendering is in progress. Return true if any update
54  * was performed. */
55  virtual bool update_render_tile(const Tile & /* tile */)
56  {
57  return false;
58  }
59 
60  /* For baking, read render pass PASS_BAKE_PRIMITIVE and PASS_BAKE_DIFFERENTIAL
61  * to determine which shading points to use for baking at each pixel. Return
62  * true if any data was read. */
63  virtual bool read_render_tile(const Tile & /* tile */)
64  {
65  return false;
66  }
67 };
68 
Tile(const int2 offset, const int2 size, const int2 full_size, const string_view layer, const string_view view)
virtual ~Tile()=default
virtual bool set_pass_pixels(const string_view pass_name, const int num_channels, const float *pixels) const =0
virtual bool get_pass_pixels(const string_view pass_name, const int num_channels, float *pixels) const =0
virtual bool read_render_tile(const Tile &)
virtual void write_render_tile(const Tile &tile)=0
OutputDriver()=default
virtual ~OutputDriver()=default
virtual bool update_render_tile(const Tile &)
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_global const KernelWorkTile * tile