Blender V5.0
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
36struct bContext;
37struct bNodeExecContext;
38struct bNodeTreeExec;
39struct GPUNodeLink;
40struct GPUNodeStack;
41struct GPUMaterial;
42
44 const bNodeTree *ntree,
45 const char **r_disabled_hint);
47 std::string idname,
48 std::optional<int16_t> legacy_type = std::nullopt);
50 std::string idname,
51 std::optional<int16_t> legacy_type = std::nullopt);
53 std::string idname,
54 std::optional<int16_t> legacy_type = std::nullopt);
60
61/* ********* exec data struct, remains internal *********** */
62
63struct XYZ_to_RGB /* Transposed #imbuf_xyz_to_rgb, passed as 3x vec3. */
64{
65 float r[3], g[3], b[3];
66};
67
68void node_gpu_stack_from_data(GPUNodeStack *gs, int type, bNodeStack *ns);
73 bNode *node,
76
78 bNodeTree *ntree,
79 bNodeInstanceKey parent_key);
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. */
86 GPUMaterial *mat,
87 bNode *output_node,
88 const int *depth_level = nullptr);
89
91
92bool node_socket_not_zero(const GPUNodeStack &socket);
93bool node_socket_not_white(const GPUNodeStack &socket);
94bool 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 sh_geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, std::optional< int16_t > legacy_type=std::nullopt)
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:238