Blender  V3.3
gpu_node_graph.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
10 #pragma once
11 
12 #include "DNA_customdata_types.h"
13 #include "DNA_listBase.h"
14 
15 #include "BLI_ghash.h"
16 
17 #include "GPU_material.h"
18 #include "GPU_shader.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 struct GPUNode;
25 struct GPUOutput;
26 struct ListBase;
27 
28 typedef enum eGPUDataSource {
39 
40 typedef enum {
53 
54 typedef enum {
57  GPU_NODE_TAG_VOLUME = (1 << 1),
60  GPU_NODE_TAG_AOV = (1 << 4),
62 } eGPUNodeTag;
63 
65 
66 struct GPUNode {
67  struct GPUNode *next, *prev;
68 
69  const char *name;
70 
71  /* Internal flag to mark nodes during pruning */
73 
76 };
77 
78 struct GPUNodeLink {
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 */
89  /* GPU_NODE_LINK_OUTPUT */
90  struct GPUOutput *output;
91  /* GPU_NODE_LINK_ATTR */
93  /* GPU_NODE_LINK_UNIFORM_ATTR */
95  /* GPU_NODE_LINK_IMAGE_BLENDER */
97  /* GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN */
98  const char *function_name;
99  };
100 };
101 
102 typedef struct GPUOutput {
103  struct GPUOutput *next, *prev;
104 
106  eGPUType type; /* data type = length of vector/matrix */
107  GPUNodeLink *link; /* output link */
108  int id; /* unique id as created by code generator */
110 
111 typedef struct GPUInput {
112  struct GPUInput *next, *prev;
113 
115  eGPUType type; /* data-type. */
117  int id; /* unique id as created by code generator */
118 
119  eGPUDataSource source; /* data source */
120 
121  /* Content based on eGPUDataSource */
122  union {
123  /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
124  float vec[16]; /* vector data */
125  /* GPU_SOURCE_TEX | GPU_SOURCE_TEX_TILED_MAPPING */
127  /* GPU_SOURCE_ATTR */
129  /* GPU_SOURCE_UNIFORM_ATTR */
131  /* GPU_SOURCE_FUNCTION_CALL */
132  char function_call[64];
133  };
135 
136 typedef struct GPUNodeGraphOutputLink {
138  int hash;
141 
142 typedef struct GPUNodeGraphFunctionLink {
144  char name[16];
147 
148 typedef struct GPUNodeGraph {
149  /* Nodes */
151 
152  /* Main Outputs. */
157  /* List of GPUNodeGraphOutputLink */
159  /* List of GPUNodeGraphFunctionLink */
161 
162  /* Requested attributes and textures. */
165 
166  /* The list of uniform attributes. */
168 
172 
173 /* Node Graph */
174 
185 
186 /* Material calls */
187 
193  int size,
194  float *pixels,
195  float *row);
196 
197 #ifdef __cplusplus
198 }
199 #endif
struct GSet GSet
Definition: BLI_ghash.h:340
#define ENUM_OPERATORS(_type, _max)
These structs are the foundation for all linked lists in the library system.
eGPUType
Definition: GPU_material.h:45
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
Depsgraph * graph
Material material
struct GPUNodeGraphOutputLink GPUNodeGraphOutputLink
eGPUNodeTag
@ GPU_NODE_TAG_NONE
@ GPU_NODE_TAG_SURFACE
@ GPU_NODE_TAG_DISPLACEMENT
@ GPU_NODE_TAG_VOLUME
@ GPU_NODE_TAG_FUNCTION
@ GPU_NODE_TAG_THICKNESS
@ GPU_NODE_TAG_AOV
struct GPUOutput GPUOutput
struct GPUNodeGraph * gpu_material_node_graph(struct GPUMaterial *material)
Definition: gpu_material.c:569
eGPUDataSource
@ GPU_SOURCE_CONSTANT
@ GPU_SOURCE_FUNCTION_CALL
@ GPU_SOURCE_ATTR
@ GPU_SOURCE_UNIFORM
@ GPU_SOURCE_OUTPUT
@ GPU_SOURCE_TEX_TILED_MAPPING
@ GPU_SOURCE_UNIFORM_ATTR
@ GPU_SOURCE_STRUCT
@ GPU_SOURCE_TEX
struct GPUNodeGraph GPUNodeGraph
void gpu_node_graph_finalize_uniform_attrs(GPUNodeGraph *graph)
struct GPUTexture ** gpu_material_ramp_texture_row_set(struct GPUMaterial *mat, int size, float *pixels, float *row)
Definition: gpu_material.c:99
struct GPUNodeGraphFunctionLink GPUNodeGraphFunctionLink
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_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
struct GPUInput GPUInput
void gpu_node_graph_free_nodes(GPUNodeGraph *graph)
SymEdge< T > * prev(const SymEdge< T > *se)
Definition: delaunay_2d.cc:105
struct GPUUniformAttr * uniform_attr
GPUNode * node
GPUNodeLink * link
char function_call[64]
eGPUDataSource source
struct GPUMaterialAttribute * attr
float vec[16]
struct GPUInput * prev
struct GPUMaterialTexture * texture
struct GPUInput * next
eGPUType type
GSet * used_libraries
GPUNodeLink * outlink_displacement
ListBase nodes
ListBase outlink_aovs
GPUNodeLink * outlink_thickness
GPUNodeLink * outlink_volume
ListBase attributes
GPUNodeLink * outlink_surface
ListBase textures
GPUUniformAttrList uniform_attrs
ListBase material_functions
struct GPUNode * next
eGPUNodeTag tag
ListBase outputs
ListBase inputs
const char * name
GPUNodeLink * link
struct GPUOutput * prev
GPUNode * node
eGPUType type
struct GPUOutput * next