Blender V4.3
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
11#pragma once
12
14#include "DNA_listBase.h"
15
16#include "BLI_ghash.h"
17
18#include "GPU_material.hh"
19#include "GPU_shader.hh"
20
21struct GPUNode;
22struct GPUOutput;
23struct ListBase;
24
38
54
65
67
68struct GPUNode {
69 GPUNode *next, *prev;
70
71 const char *name;
72
73 /* Internal flag to mark nodes during pruning */
75
78};
79
82
84 int users; /* Refcount */
85
86 union {
87 /* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */
88 const float *data;
89 /* GPU_NODE_LINK_COLORBAND */
90 GPUTexture **colorband;
91 /* GPU_NODE_LINK_OUTPUT */
93 /* GPU_NODE_LINK_ATTR */
95 /* GPU_NODE_LINK_UNIFORM_ATTR */
97 /* GPU_NODE_LINK_LAYER_ATTR */
99 /* GPU_NODE_LINK_IMAGE_BLENDER */
101 /* GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN */
102 const char *function_name;
103 };
104};
105
106struct GPUOutput {
108
110 eGPUType type; /* data type = length of vector/matrix */
111 GPUNodeLink *link; /* output link */
112 int id; /* unique id as created by code generator */
113};
114
115struct GPUInput {
117
119 eGPUType type; /* data-type. */
121 int id; /* unique id as created by code generator */
122
123 eGPUDataSource source; /* data source */
124
125 /* Content based on eGPUDataSource */
126 union {
127 /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
128 float vec[16]; /* vector data */
129 /* GPU_SOURCE_TEX | GPU_SOURCE_TEX_TILED_MAPPING */
131 /* GPU_SOURCE_ATTR */
133 /* GPU_SOURCE_UNIFORM_ATTR */
135 /* GPU_SOURCE_LAYER_ATTR */
137 /* GPU_SOURCE_FUNCTION_CALL */
139 };
140};
141
147
153
155 /* Nodes */
157
158 /* Main Outputs. */
163 /* List of GPUNodeGraphOutputLink */
165 /* List of GPUNodeGraphFunctionLink */
167 /* List of GPUNodeGraphOutputLink */
169
170 /* Requested attributes and textures. */
173
174 /* The list of uniform attributes. */
176
177 /* The list of layer attributes. */
179
182};
183
184/* Node Graph */
185
186void gpu_nodes_tag(GPUNodeLink *link, eGPUNodeTag tag);
189
202
211
212/* Material calls */
213
219 int size,
220 const float *pixels,
221 float *r_row);
226 GPUMaterial *mat, int width, int height, const float *pixels, float *row);
struct GSet GSet
Definition BLI_ghash.h:341
#define ENUM_OPERATORS(_type, _max)
These structs are the foundation for all linked lists in the library system.
eGPUType
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
ListBase outputs
ListBase inputs
const char * name
GPUNode * next
GPUNodeLink * link
GPUNode * node
eGPUType type
GPUOutput * next
GPUOutput * prev