Blender V4.5
gpu_node_graph.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
10
11#pragma once
12
13#include "DNA_listBase.h"
14
15#include "BLI_ghash.h"
16
17#include "GPU_material.hh"
18
19struct GPUNode;
20struct GPUOutput;
21struct ListBase;
22
36
52
63
65
66struct GPUNode {
68
69 const char *name;
70
71 /* Internal flag to mark nodes during pruning */
73
76};
77
80
82 int users; /* Refcount */
83
84 union {
85 /* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */
86 const float *data;
87 /* GPU_NODE_LINK_COLORBAND */
88 GPUTexture **colorband;
89 /* GPU_NODE_LINK_OUTPUT */
91 /* GPU_NODE_LINK_ATTR */
93 /* GPU_NODE_LINK_UNIFORM_ATTR */
95 /* GPU_NODE_LINK_LAYER_ATTR */
97 /* GPU_NODE_LINK_IMAGE_BLENDER */
99 /* GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN */
100 struct {
101 const char *function_name;
104 };
105};
106
107struct GPUOutput {
109
111 eGPUType type; /* data type = length of vector/matrix */
112 GPUNodeLink *link; /* output link */
113 int id; /* unique id as created by code generator */
114};
115
116struct GPUInput {
118
120 eGPUType type; /* data-type. */
122 int id; /* unique id as created by code generator */
123
124 eGPUDataSource source; /* data source */
125
126 /* Content based on eGPUDataSource */
127 union {
128 /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
129 float vec[16]; /* vector data */
130 /* GPU_SOURCE_TEX | GPU_SOURCE_TEX_TILED_MAPPING */
132 /* GPU_SOURCE_ATTR */
134 /* GPU_SOURCE_UNIFORM_ATTR */
136 /* GPU_SOURCE_LAYER_ATTR */
138 /* GPU_SOURCE_FUNCTION_CALL */
140 };
141};
142
148
154
156 /* Nodes */
158
159 /* Main Outputs. */
164 /* List of GPUNodeGraphOutputLink */
166 /* List of GPUNodeGraphFunctionLink */
168 /* List of GPUNodeGraphOutputLink */
170
171 /* Requested attributes and textures. */
174
175 /* The list of uniform attributes. */
177
178 /* The list of layer attributes. */
180
183};
184
185/* Node Graph */
186
187void gpu_nodes_tag(GPUNodeLink *link, eGPUNodeTag tag);
190
203
212
213/* Material calls */
214
220 int size,
221 const float *pixels,
222 float *r_row);
227 GPUMaterial *mat, int width, int height, const float *pixels, float *row);
struct GSet GSet
Definition BLI_ghash.h:337
#define ENUM_OPERATORS(_type, _max)
These structs are the foundation for all linked lists in the library system.
eGPUType
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
GPUTexture ** gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, const float *pixels, float *r_row)
eGPUNodeTag
@ GPU_NODE_TAG_NONE
@ GPU_NODE_TAG_SURFACE
@ GPU_NODE_TAG_DISPLACEMENT
@ GPU_NODE_TAG_VOLUME
@ GPU_NODE_TAG_FUNCTION
@ GPU_NODE_TAG_COMPOSITOR
@ GPU_NODE_TAG_THICKNESS
@ GPU_NODE_TAG_AOV
eGPUDataSource
@ GPU_SOURCE_CONSTANT
@ GPU_SOURCE_FUNCTION_CALL
@ GPU_SOURCE_ATTR
@ GPU_SOURCE_CRYPTOMATTE
@ GPU_SOURCE_UNIFORM
@ GPU_SOURCE_OUTPUT
@ GPU_SOURCE_TEX_TILED_MAPPING
@ GPU_SOURCE_UNIFORM_ATTR
@ GPU_SOURCE_LAYER_ATTR
@ GPU_SOURCE_STRUCT
@ GPU_SOURCE_TEX
GPUTexture ** gpu_material_sky_texture_layer_set(GPUMaterial *mat, int width, int height, const float *pixels, float *row)
void gpu_nodes_tag(GPUNodeLink *link, eGPUNodeTag tag)
void gpu_node_graph_finalize_uniform_attrs(GPUNodeGraph *graph)
void gpu_node_graph_optimize(GPUNodeGraph *graph)
void gpu_node_graph_free(GPUNodeGraph *graph)
void gpu_node_graph_prune_unused(GPUNodeGraph *graph)
GPUNodeLinkType
@ GPU_NODE_LINK_UNIFORM
@ GPU_NODE_LINK_NONE
@ GPU_NODE_LINK_IMAGE_SKY
@ GPU_NODE_LINK_LAYER_ATTR
@ GPU_NODE_LINK_ATTR
@ GPU_NODE_LINK_IMAGE
@ GPU_NODE_LINK_IMAGE_TILED
@ GPU_NODE_LINK_CONSTANT
@ GPU_NODE_LINK_IMAGE_TILED_MAPPING
@ GPU_NODE_LINK_COLORBAND
@ GPU_NODE_LINK_UNIFORM_ATTR
@ GPU_NODE_LINK_OUTPUT
@ GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN
void gpu_node_graph_free_nodes(GPUNodeGraph *graph)
GPUNodeGraph * gpu_material_node_graph(GPUMaterial *material)
GPUMaterialAttribute * attr
GPUNode * node
GPUNodeLink * link
char function_call[64]
GPUMaterialTexture * texture
eGPUDataSource source
GPUInput * next
float vec[16]
GPUInput * prev
GPULayerAttr * layer_attr
GPUUniformAttr * uniform_attr
eGPUType type
ListBase outlink_compositor
GPUNodeLink * outlink_displacement
ListBase layer_attrs
ListBase outlink_aovs
GPUNodeLink * outlink_thickness
GPUNodeLink * outlink_volume
ListBase attributes
GPUNodeLink * outlink_surface
GPUUniformAttrList uniform_attrs
ListBase material_functions
eGPUNodeTag tag
GPUNode * prev
ListBase outputs
ListBase inputs
const char * name
GPUNode * next
GPUNodeLink * link
GPUNode * node
eGPUType type
GPUOutput * next
GPUOutput * prev