Blender  V3.3
pass.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
6 #include <ostream> // NOLINT
7 
8 #include "util/string.h"
9 #include "util/vector.h"
10 
11 #include "kernel/types.h"
12 
13 #include "graph/node.h"
14 
16 
17 const char *pass_type_as_string(const PassType type);
18 
19 enum class PassMode {
20  NOISY,
21  DENOISED,
22 };
23 const char *pass_mode_as_string(PassMode mode);
24 std::ostream &operator<<(std::ostream &os, PassMode mode);
25 
26 struct PassInfo {
27  int num_components = -1;
28  bool use_filter = false;
29  bool use_exposure = false;
30  bool is_written = true;
34 
35  /* Pass access for read can not happen directly and needs some sort of compositing (for example,
36  * light passes due to divide_type, or shadow catcher pass. */
37  bool use_compositing = false;
38 
39  /* Used to disable albedo pass for denoising.
40  * Light and shadow catcher passes should not have discontinuity in the denoised result based on
41  * the underlying albedo. */
42  bool use_denoising_albedo = true;
43 
44  /* Pass supports denoising. */
45  bool support_denoise = false;
46 };
47 
48 class Pass : public Node {
49  public:
51 
54  NODE_SOCKET_API(ustring, name)
55  NODE_SOCKET_API(bool, include_albedo)
56  NODE_SOCKET_API(ustring, lightgroup)
57 
58  Pass();
59 
60  PassInfo get_info() const;
61 
62  /* The pass is written by the render pipeline (kernel or denoiser). If the pass is written it
63  * will have pixels allocated in a RenderBuffer. Passes which are not written do not have their
64  * pixels allocated to save memory. */
65  bool is_written() const;
66 
67  protected:
68  /* The has been created automatically as a requirement to various rendering functionality (such
69  * as adaptive sampling). */
70  bool is_auto_;
71 
72  public:
73  static const NodeEnum *get_type_enum();
74  static const NodeEnum *get_mode_enum();
75 
77  const bool include_albedo = false,
78  const bool is_lightgroup = false);
79 
80  static bool contains(const vector<Pass *> &passes, PassType type);
81 
82  /* Returns nullptr if there is no pass with the given name or type+mode. */
83  static const Pass *find(const vector<Pass *> &passes, const string &name);
84  static const Pass *find(const vector<Pass *> &passes,
85  PassType type,
87  const ustring &lightgroup = ustring());
88 
89  /* Returns PASS_UNUSED if there is no corresponding pass. */
90  static int get_offset(const vector<Pass *> &passes, const Pass *pass);
91 
92  friend class Film;
93 };
94 
95 std::ostream &operator<<(std::ostream &os, const Pass &pass);
96 
_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 type
Definition: film.h:29
Definition: pass.h:48
PassInfo get_info() const
Definition: pass.cpp:136
static const NodeEnum * get_type_enum()
Definition: pass.cpp:44
NODE_DECLARE Pass()
Definition: pass.cpp:132
bool is_written() const
Definition: pass.cpp:141
static const NodeEnum * get_mode_enum()
Definition: pass.cpp:104
bool is_auto_
Definition: pass.h:70
static const Pass * find(const vector< Pass * > &passes, const string &name)
Definition: pass.cpp:362
static bool contains(const vector< Pass * > &passes, PassType type)
Definition: pass.cpp:349
static int get_offset(const vector< Pass * > &passes, const Pass *pass)
Definition: pass.cpp:389
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
#define NODE_SOCKET_API(type_, name)
Definition: graph/node.h:54
PassType
Definition: kernel/types.h:334
@ PASS_NONE
Definition: kernel/types.h:335
#define NODE_DECLARE
Definition: node_type.h:135
const char * pass_mode_as_string(PassMode mode)
Definition: pass.cpp:25
std::ostream & operator<<(std::ostream &os, PassMode mode)
Definition: pass.cpp:38
PassMode
Definition: pass.h:19
CCL_NAMESPACE_BEGIN const char * pass_type_as_string(const PassType type)
Definition: pass.cpp:11
const NodeType * type
Definition: graph/node.h:175
ustring name
Definition: graph/node.h:174
Definition: pass.h:26
PassType direct_type
Definition: pass.h:32
bool use_compositing
Definition: pass.h:37
bool use_denoising_albedo
Definition: pass.h:42
int num_components
Definition: pass.h:27
bool support_denoise
Definition: pass.h:45
bool use_filter
Definition: pass.h:28
PassType divide_type
Definition: pass.h:31
bool use_exposure
Definition: pass.h:29
PassType indirect_type
Definition: pass.h:33
bool is_written
Definition: pass.h:30