Blender V4.3
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
9#pragma once
10
11#include <cfloat>
12#include <cmath>
13
14#include "BKE_node.hh"
15
16#include "DNA_node_types.h"
17
18#include "GPU_material.hh"
19
21
23
24#ifdef WITH_MATERIALX
26#else
27# define NODE_SHADER_MATERIALX_BEGIN \
28 blender::bke::NodeMaterialXFunction node_shader_materialx = nullptr;
29# define NODE_SHADER_MATERIALX_END
30#endif
31
32struct bContext;
33struct bNodeExecContext;
34struct bNodeTreeExec;
35struct GPUNodeLink;
36struct GPUNodeStack;
37struct GPUMaterial;
38
40 const bNodeTree *ntree,
41 const char **r_disabled_hint);
42void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass);
44 int type,
45 const char *name,
46 short nclass);
52
53/* ********* exec data struct, remains internal *********** */
54
55struct XYZ_to_RGB /* Transposed #imbuf_xyz_to_rgb, passed as 3x vec3. */
56{
57 float r[3], g[3], b[3];
58};
59
60void node_gpu_stack_from_data(GPUNodeStack *gs, int type, bNodeStack *ns);
65 bNode *node,
66 GPUNodeStack *in,
67 GPUNodeStack *out);
68
70 bNodeTree *ntree,
71 bNodeInstanceKey parent_key);
73
74/* If depth_level is not null, only nodes where `node->runtime->tmp_flag == depth_level` will be
75 * executed. This allows finer control over node execution order without modifying the tree
76 * topology. */
78 GPUMaterial *mat,
79 bNode *output_node,
80 int *depth_level = nullptr);
81
83
84bool node_socket_not_zero(const GPUNodeStack &socket);
85bool node_socket_not_white(const GPUNodeStack &socket);
86bool node_socket_not_black(const GPUNodeStack &socket);
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
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 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 sh_fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
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)
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 ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node, int *depth_level=nullptr)
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:218