Blender V5.0
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 /* Zones. */
80};
81
84
86 int users; /* Refcount */
87
88 union {
89 /* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */
90 const float *data;
91 /* GPU_NODE_LINK_COLORBAND */
93 /* GPU_NODE_LINK_OUTPUT */
95 /* GPU_NODE_LINK_ATTR */
97 /* GPU_NODE_LINK_UNIFORM_ATTR */
99 /* GPU_NODE_LINK_LAYER_ATTR */
101 /* GPU_NODE_LINK_IMAGE_BLENDER */
103 /* GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN */
104 struct {
105 const char *function_name;
108 };
109};
110
111struct GPUOutput {
113
115 GPUType type; /* data type = length of vector/matrix */
116 GPUNodeLink *link; /* output link */
117 int id; /* unique id as created by code generator */
118
119 /* True for Zone Items. */
121 /* This variable is shared with other socket/s and doesn't need to be declared. */
123};
124
125struct GPUInput {
127
129 GPUType type; /* data-type. */
131 int id; /* unique id as created by code generator */
132
133 GPUDataSource source; /* data source */
134
135 /* Content based on GPUDataSource */
136 union {
137 /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
138 float vec[16]; /* vector data */
139 /* GPU_SOURCE_TEX | GPU_SOURCE_TEX_TILED_MAPPING */
141 /* GPU_SOURCE_ATTR */
143 /* GPU_SOURCE_UNIFORM_ATTR */
145 /* GPU_SOURCE_LAYER_ATTR */
147 /* GPU_SOURCE_FUNCTION_CALL */
149 };
150
151 /* True for Zone Items. */
153 /* This variable is shared with other socket/s and doesn't need to be declared. */
155};
156
162
168
170 /* Nodes */
172
173 /* Main Outputs. */
178 /* List of GPUNodeGraphOutputLink */
180 /* List of GPUNodeGraphFunctionLink */
182 /* List of GPUNodeGraphOutputLink */
184
185 /* Requested attributes and textures. */
188
189 /* The list of uniform attributes. */
191
192 /* The list of layer attributes. */
194};
195
196/* Node Graph */
197
198void gpu_nodes_tag(GPUNodeGraph *graph, GPUNodeLink *link_start, GPUNodeTag tag);
201
214
223
224/* Material calls */
225
231 int size,
232 const float *pixels,
233 float *r_row);
238 GPUMaterial *mat, int width, int height, const float *pixels, float *row);
#define ENUM_OPERATORS(_type, _max)
These structs are the foundation for all linked lists in the library system.
GPUType
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
blender::gpu::Texture ** gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, const float *pixels, float *r_row)
GPUDataSource
@ 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
void gpu_nodes_tag(GPUNodeGraph *graph, GPUNodeLink *link_start, GPUNodeTag tag)
blender::gpu::Texture ** gpu_material_sky_texture_layer_set(GPUMaterial *mat, int width, int height, const float *pixels, float *row)
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)
GPUNodeTag
@ 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
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
GPUDataSource source
GPUInput * next
float vec[16]
GPUInput * prev
GPULayerAttr * layer_attr
GPUUniformAttr * uniform_attr
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
GPUNode * prev
GPUNodeTag tag
ListBase outputs
ListBase inputs
const char * name
bool is_zone_end
GPUNode * next
GPUNodeLink * link
GPUNode * node
GPUOutput * next
GPUOutput * prev