Blender  V2.93
gpu_node_graph.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
26 #pragma once
27 
28 #include "DNA_customdata_types.h"
29 #include "DNA_listBase.h"
30 
31 #include "GPU_material.h"
32 #include "GPU_shader.h"
33 
34 struct GPUNode;
35 struct GPUOutput;
36 struct ListBase;
37 
38 typedef enum eGPUDataSource {
51 
52 typedef enum {
67 
68 struct GPUNode {
69  struct GPUNode *next, *prev;
70 
71  const char *name;
72 
73  /* Internal flag to mark nodes during pruning */
74  bool tag;
75 
78 };
79 
80 struct GPUNodeLink {
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_BUILTIN */
91  /* GPU_NODE_LINK_COLORBAND */
93  /* GPU_NODE_LINK_VOLUME_GRID */
95  /* GPU_NODE_LINK_OUTPUT */
96  struct GPUOutput *output;
97  /* GPU_NODE_LINK_ATTR */
99  /* GPU_NODE_LINK_UNIFORM_ATTR */
101  /* GPU_NODE_LINK_IMAGE_BLENDER */
103  };
104 };
105 
106 typedef struct GPUOutput {
107  struct GPUOutput *next, *prev;
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 */
114 
115 typedef struct GPUInput {
116  struct GPUInput *next, *prev;
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_BUILTIN */
130  eGPUBuiltin builtin; /* builtin uniform */
131  /* GPU_SOURCE_TEX | GPU_SOURCE_TEX_TILED_MAPPING */
133  /* GPU_SOURCE_ATTR */
135  /* GPU_SOURCE_UNIFORM_ATTR */
137  /* GPU_SOURCE_VOLUME_GRID | GPU_SOURCE_VOLUME_GRID_TRANSFORM */
139  };
141 
142 typedef struct GPUNodeGraphOutputLink {
144  int hash;
147 
148 typedef struct GPUNodeGraph {
149  /* Nodes */
151 
152  /* Main Output. */
154  /* List of GPUNodeGraphOutputLink */
156 
157  /* Requested attributes and textures. */
161 
162  /* The list of uniform attributes. */
165 
166 /* Node Graph */
167 
172 
173 /* Material calls */
174 
177  int size,
178  float *pixels,
179  float *row);
180 
struct GSet GSet
Definition: BLI_ghash.h:189
These structs are the foundation for all linked lists in the library system.
eGPUBuiltin
Definition: GPU_material.h:86
eGPUType
Definition: GPU_material.h:59
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
Depsgraph * graph
Material material
struct GPUNodeGraphOutputLink GPUNodeGraphOutputLink
struct GSet * gpu_material_used_libraries(struct GPUMaterial *material)
Definition: gpu_material.c:613
struct GPUOutput GPUOutput
struct GPUNodeGraph * gpu_material_node_graph(struct GPUMaterial *material)
Definition: gpu_material.c:608
eGPUDataSource
@ GPU_SOURCE_CONSTANT
@ GPU_SOURCE_ATTR
@ GPU_SOURCE_VOLUME_GRID_TRANSFORM
@ GPU_SOURCE_UNIFORM
@ GPU_SOURCE_VOLUME_GRID
@ GPU_SOURCE_OUTPUT
@ GPU_SOURCE_TEX_TILED_MAPPING
@ GPU_SOURCE_BUILTIN
@ 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:121
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_BUILTIN
@ GPU_NODE_LINK_VOLUME_GRID_TRANSFORM
@ GPU_NODE_LINK_VOLUME_GRID
@ GPU_NODE_LINK_COLORBAND
@ GPU_NODE_LINK_UNIFORM_ATTR
@ GPU_NODE_LINK_OUTPUT
struct GPUInput GPUInput
void gpu_node_graph_free_nodes(GPUNodeGraph *graph)
struct GPUUniformAttr * uniform_attr
GPUNode * node
GPUNodeLink * link
eGPUDataSource source
struct GPUMaterialAttribute * attr
eGPUBuiltin builtin
struct GPUMaterialVolumeGrid * volume_grid
float vec[16]
struct GPUInput * prev
struct GPUMaterialTexture * texture
struct GPUInput * next
eGPUType type
ListBase nodes
ListBase outlink_aovs
GPUNodeLink * outlink
ListBase attributes
ListBase volume_grids
ListBase textures
GPUUniformAttrList uniform_attrs
struct GPUNode * next
struct GPUNode * prev
ListBase outputs
ListBase inputs
const char * name
GPUNodeLink * link
struct GPUOutput * prev
GPUNode * node
eGPUType type
struct GPUOutput * next