Blender
V5.0
source
blender
nodes
shader
node_shader_util.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2005 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include <cfloat>
12
#include <optional>
13
14
#include "
BLI_listbase.h
"
// IWYU pragma: export
15
#include "
BLI_math_constants.h
"
// IWYU pragma: export
16
17
#include "
BKE_node.hh
"
18
#include "
BKE_node_legacy_types.hh
"
// IWYU pragma: export
19
20
#include "
DNA_node_types.h
"
21
22
#include "
GPU_material.hh
"
23
24
#include "
NOD_socket_declarations.hh
"
// IWYU pragma: export
25
26
#include "
node_shader_register.hh
"
// IWYU pragma: export
27
28
#ifdef WITH_MATERIALX
29
# include "
materialx/node_parser.h
"
// IWYU pragma: export
30
#else
31
# define NODE_SHADER_MATERIALX_BEGIN \
32
blender::bke::NodeMaterialXFunction node_shader_materialx = nullptr;
33
# define NODE_SHADER_MATERIALX_END
34
#endif
35
36
struct
bContext
;
37
struct
bNodeExecContext
;
38
struct
bNodeTreeExec
;
39
struct
GPUNodeLink
;
40
struct
GPUNodeStack
;
41
struct
GPUMaterial
;
42
43
bool
sh_node_poll_default
(
const
blender::bke::bNodeType
*ntype,
44
const
bNodeTree
*ntree,
45
const
char
**r_disabled_hint);
46
void
sh_node_type_base
(
blender::bke::bNodeType
*ntype,
47
std::string idname,
48
std::optional<int16_t> legacy_type = std::nullopt);
49
void
sh_geo_node_type_base
(
blender::bke::bNodeType
*ntype,
50
std::string idname,
51
std::optional<int16_t> legacy_type = std::nullopt);
52
void
common_node_type_base
(
blender::bke::bNodeType
*ntype,
53
std::string idname,
54
std::optional<int16_t> legacy_type = std::nullopt);
55
bool
line_style_shader_nodes_poll
(
const
bContext
*
C
);
56
bool
world_shader_nodes_poll
(
const
bContext
*
C
);
57
bool
object_shader_nodes_poll
(
const
bContext
*
C
);
58
bool
object_cycles_shader_nodes_poll
(
const
bContext
*
C
);
59
bool
object_eevee_shader_nodes_poll
(
const
bContext
*
C
);
60
61
/* ********* exec data struct, remains internal *********** */
62
63
struct
XYZ_to_RGB
/* Transposed #imbuf_xyz_to_rgb, passed as 3x vec3. */
64
{
65
float
r
[3],
g
[3],
b
[3];
66
};
67
68
void
node_gpu_stack_from_data
(
GPUNodeStack
*gs,
int
type,
bNodeStack
*ns);
69
void
node_data_from_gpu_stack
(
bNodeStack
*ns,
GPUNodeStack
*gs);
70
void
node_shader_gpu_bump_tex_coord
(
GPUMaterial
*mat,
bNode
*node,
GPUNodeLink
**link);
71
void
node_shader_gpu_default_tex_coord
(
GPUMaterial
*mat,
bNode
*node,
GPUNodeLink
**link);
72
void
node_shader_gpu_tex_mapping
(
GPUMaterial
*mat,
73
bNode
*node,
74
GPUNodeStack
*
in
,
75
GPUNodeStack
*
out
);
76
77
bNodeTreeExec
*
ntreeShaderBeginExecTree_internal
(
bNodeExecContext
*context,
78
bNodeTree
*ntree,
79
bNodeInstanceKey
parent_key);
80
void
ntreeShaderEndExecTree_internal
(
bNodeTreeExec
*
exec
);
81
82
/* If depth_level is not null, only nodes where `node->runtime->tmp_flag == depth_level` will be
83
* executed. This allows finer control over node execution order without modifying the tree
84
* topology. */
85
void
ntreeExecGPUNodes
(
bNodeTreeExec
*
exec
,
86
GPUMaterial
*mat,
87
bNode
*output_node,
88
const
int
*depth_level =
nullptr
);
89
90
void
get_XYZ_to_RGB_for_gpu
(
XYZ_to_RGB
*
data
);
91
92
bool
node_socket_not_zero
(
const
GPUNodeStack
&socket);
93
bool
node_socket_not_white
(
const
GPUNodeStack
&socket);
94
bool
node_socket_not_black
(
const
GPUNodeStack
&socket);
BKE_node.hh
BKE_node_legacy_types.hh
BLI_listbase.h
BLI_math_constants.h
DNA_node_types.h
GPU_material.hh
NOD_socket_declarations.hh
C
#define C
Definition
RandGen.cpp:29
data
BMesh const char void * data
Definition
bmesh_iterators_inline.hh:37
in
#define in
Definition
gpu_shader_compat_cxx.hh:50
out
#define out
Definition
gpu_shader_compat_cxx.hh:48
node_parser.h
node_shader_register.hh
sh_node_poll_default
bool sh_node_poll_default(const blender::bke::bNodeType *ntype, const bNodeTree *ntree, const char **r_disabled_hint)
Definition
node_shader_util.cc:30
ntreeShaderBeginExecTree_internal
bNodeTreeExec * ntreeShaderBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key)
Definition
node_shader_tree.cc:1032
line_style_shader_nodes_poll
bool line_style_shader_nodes_poll(const bContext *C)
Definition
node_shader_util.cc:94
node_shader_gpu_default_tex_coord
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
Definition
node_shader_util.cc:391
common_node_type_base
void common_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional< int16_t > legacy_type=std::nullopt)
Definition
node_shader_util.cc:85
node_shader_gpu_tex_mapping
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
Definition
node_shader_util.cc:399
node_data_from_gpu_stack
void node_data_from_gpu_stack(bNodeStack *ns, GPUNodeStack *gs)
Definition
node_shader_util.cc:222
node_socket_not_white
bool node_socket_not_white(const GPUNodeStack &socket)
Definition
node_shader_util.cc:447
node_shader_gpu_bump_tex_coord
void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
Definition
node_shader_util.cc:386
object_cycles_shader_nodes_poll
bool object_cycles_shader_nodes_poll(const bContext *C)
Definition
node_shader_util.cc:112
ntreeExecGPUNodes
void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node, const int *depth_level=nullptr)
Definition
node_shader_util.cc:337
sh_geo_node_type_base
void sh_geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional< int16_t > legacy_type=std::nullopt)
Definition
node_shader_util.cc:74
get_XYZ_to_RGB_for_gpu
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data)
Definition
node_shader_util.cc:429
object_shader_nodes_poll
bool object_shader_nodes_poll(const bContext *C)
Definition
node_shader_util.cc:106
object_eevee_shader_nodes_poll
bool object_eevee_shader_nodes_poll(const bContext *C)
Definition
node_shader_util.cc:121
node_socket_not_black
bool node_socket_not_black(const GPUNodeStack &socket)
Definition
node_shader_util.cc:451
sh_node_type_base
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional< int16_t > legacy_type=std::nullopt)
Definition
node_shader_util.cc:63
world_shader_nodes_poll
bool world_shader_nodes_poll(const bContext *C)
Definition
node_shader_util.cc:100
node_socket_not_zero
bool node_socket_not_zero(const GPUNodeStack &socket)
Definition
node_shader_util.cc:443
node_gpu_stack_from_data
void node_gpu_stack_from_data(GPUNodeStack *gs, int type, bNodeStack *ns)
Definition
node_shader_util.cc:172
ntreeShaderEndExecTree_internal
void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec)
Definition
node_shader_tree.cc:1074
exec
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
Definition
node_texture_at.cc:31
GPUMaterial
Definition
gpu/intern/gpu_material.cc:63
GPUNodeLink
Definition
gpu_node_graph.hh:82
GPUNodeStack
Definition
GPU_material.hh:295
XYZ_to_RGB
Definition
node_shader_util.hh:64
XYZ_to_RGB::r
float r[3]
Definition
node_shader_util.hh:65
XYZ_to_RGB::b
float b[3]
Definition
node_shader_util.hh:65
XYZ_to_RGB::g
float g[3]
Definition
node_shader_util.hh:65
bContext
Definition
blenkernel/intern/context.cc:63
bNodeExecContext
Definition
node_util.hh:20
bNodeInstanceKey
Definition
DNA_node_types.h:654
bNodeStack
Definition
DNA_node_types.h:86
bNodeTreeExec
Definition
node_exec.hh:32
bNodeTree
Definition
DNA_node_types.h:759
bNode
Definition
DNA_node_types.h:422
blender::bke::bNodeType
Defines a node type.
Definition
BKE_node.hh:238
Generated on
for Blender by
doxygen
1.16.1