Blender
V5.3
source
blender
compositor
COM_shader_node.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
BLI_string_ref.hh
"
8
#include "
BLI_vector.hh
"
9
10
#include "
DNA_node_types.h
"
11
12
#include "
GPU_material.hh
"
13
14
namespace
blender::compositor
{
15
16
/* ------------------------------------------------------------------------------------------------
17
* Shader Node
18
*
19
* A shader node encapsulates a compositor node tree that is capable of being used together with
20
* other shader nodes to construct a Shader Operation using the GPU material compiler. A GPU node
21
* stack for each of the node inputs and outputs is stored and populated during construction in
22
* order to represent the node as a GPU node inside the GPU material graph, see GPU_material.hh for
23
* more information. The compiler is expected to initialize the input links of the node inputs
24
* before invoking the compile method. See the discussion in COM_shader_operation.hh for more
25
* information. */
26
class
ShaderNode
{
27
private
:
28
/* The node that this operation represents. */
29
const
bNode
&node_;
30
/* The GPU node stacks of the inputs of the node. Those are populated during construction in the
31
* populate_inputs method. The links of the inputs are initialized by the GPU material compiler
32
* prior to calling the compile method. There is an extra stack at the end to mark the end of the
33
* array, as this is what the GPU module functions expect. */
34
Vector<GPUNodeStack>
inputs_;
35
/* The GPU node stacks of the outputs of the node. Those are populated during construction in the
36
* populate_outputs method. There is an extra stack at the end to mark the end of the array, as
37
* this is what the GPU module functions expect. */
38
Vector<GPUNodeStack>
outputs_;
39
40
public
:
41
/* Construct the node by populating both its inputs and outputs. */
42
ShaderNode
(
const
bNode
&
node
);
43
44
/* Compile the node by adding the appropriate GPU material graph nodes and linking the
45
* appropriate resources. */
46
void
compile
(
GPUMaterial
*material);
47
48
/* Returns the GPU node stack of the input with the given identifier. */
49
GPUNodeStack
&
get_input
(
StringRef
identifier);
50
51
/* Returns the GPU node stack of the output with the given identifier. */
52
GPUNodeStack
&
get_output
(
StringRef
identifier);
53
54
private
:
55
/* Populate the inputs of the node. The input link is set to nullptr and is expected to be
56
* initialized by the GPU material compiler before calling the compile method. */
57
void
populate_inputs();
58
/* Populate the outputs of the node. The output link is set to nullptr and is expected to be
59
* initialized by the compile method. */
60
void
populate_outputs();
61
};
62
63
}
// namespace blender::compositor
BLI_string_ref.hh
BLI_vector.hh
DNA_node_types.h
GPU_material.hh
blender::StringRef
Definition
BLI_string_ref.hh:165
blender::compositor::ShaderNode::get_input
GPUNodeStack & get_input(StringRef identifier)
Definition
shader_node.cc:32
blender::compositor::ShaderNode::compile
void compile(GPUMaterial *material)
Definition
shader_node.cc:26
blender::compositor::ShaderNode::ShaderNode
ShaderNode(const bNode &node)
Definition
shader_node.cc:20
blender::compositor::ShaderNode::get_output
GPUNodeStack & get_output(StringRef identifier)
Definition
shader_node.cc:37
node
#define node
Definition
gpu_shader_cxx_attribute.hh:142
blender::compositor
Definition
BKE_node.hh:77
blender::GPUMaterial
Definition
gpu_material.cc:66
blender::GPUNodeStack
Definition
GPU_material.hh:465
blender::bNode
Definition
DNA_node_types.h:1641
lexit::Vector
Definition
vector.hh:68
Generated on
for Blender by
doxygen
1.18.0