Blender V4.5
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
16#include "BKE_node.hh"
17#include "BKE_node_legacy_types.hh" // IWYU pragma: export
18
19#include "DNA_node_types.h"
20
21#include "GPU_material.hh"
22
23#include "NOD_socket_declarations.hh" // IWYU pragma: export
24
25#include "node_shader_register.hh" // IWYU pragma: export
26
27#ifdef WITH_MATERIALX
28# include "materialx/node_parser.h" // IWYU pragma: export
29#else
30# define NODE_SHADER_MATERIALX_BEGIN \
31 blender::bke::NodeMaterialXFunction node_shader_materialx = nullptr;
32# define NODE_SHADER_MATERIALX_END
33#endif
34
35struct bContext;
36struct bNodeExecContext;
37struct bNodeTreeExec;
38struct GPUNodeLink;
39struct GPUNodeStack;
40struct GPUMaterial;
41
43 const bNodeTree *ntree,
44 const char **r_disabled_hint);
46 std::string idname,
47 std::optional<int16_t> legacy_type = std::nullopt);
49 std::string idname,
50 std::optional<int16_t> legacy_type = std::nullopt);
56
57/* ********* exec data struct, remains internal *********** */
58
59struct XYZ_to_RGB /* Transposed #imbuf_xyz_to_rgb, passed as 3x vec3. */
60{
61 float r[3], g[3], b[3];
62};
63
64void node_gpu_stack_from_data(GPUNodeStack *gs, int type, bNodeStack *ns);
69 bNode *node,
72
74 bNodeTree *ntree,
75 bNodeInstanceKey parent_key);
77
78/* If depth_level is not null, only nodes where `node->runtime->tmp_flag == depth_level` will be
79 * executed. This allows finer control over node execution order without modifying the tree
80 * topology. */
82 GPUMaterial *mat,
83 bNode *output_node,
84 const int *depth_level = nullptr);
85
87
88bool node_socket_not_zero(const GPUNodeStack &socket);
89bool node_socket_not_white(const GPUNodeStack &socket);
90bool node_socket_not_black(const GPUNodeStack &socket);
#define C
Definition RandGen.cpp:29
BMesh const char void * data
#define in
#define out
bool sh_node_poll_default(const blender::bke::bNodeType *ntype, const bNodeTree *ntree, const char **r_disabled_hint)
bNodeTreeExec * ntreeShaderBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key)
bool line_style_shader_nodes_poll(const bContext *C)
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void common_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional< int16_t > legacy_type=std::nullopt)
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
void node_data_from_gpu_stack(bNodeStack *ns, GPUNodeStack *gs)
bool node_socket_not_white(const GPUNodeStack &socket)
void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
bool object_cycles_shader_nodes_poll(const bContext *C)
void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node, const int *depth_level=nullptr)
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data)
bool object_shader_nodes_poll(const bContext *C)
bool object_eevee_shader_nodes_poll(const bContext *C)
bool node_socket_not_black(const GPUNodeStack &socket)
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional< int16_t > legacy_type=std::nullopt)
bool world_shader_nodes_poll(const bContext *C)
bool node_socket_not_zero(const GPUNodeStack &socket)
void node_gpu_stack_from_data(GPUNodeStack *gs, int type, bNodeStack *ns)
void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec)
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
Defines a node type.
Definition BKE_node.hh:226