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