Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_node_graph.c
| Show First 20 Lines • Show All 639 Lines • ▼ Show 20 Lines | void gpu_node_graph_free_nodes(GPUNodeGraph *graph) | ||||
| graph->outlink = NULL; | graph->outlink = NULL; | ||||
| } | } | ||||
| /* Free both node graph and requested attributes and textures. */ | /* Free both node graph and requested attributes and textures. */ | ||||
| void gpu_node_graph_free(GPUNodeGraph *graph) | void gpu_node_graph_free(GPUNodeGraph *graph) | ||||
| { | { | ||||
| gpu_node_graph_free_nodes(graph); | gpu_node_graph_free_nodes(graph); | ||||
| for (GPUMaterialVolumeGrid *grid = graph->volume_grids.first; grid; grid = grid->next) { | LISTBASE_FOREACH (GPUMaterialVolumeGrid *, grid, &graph->volume_grids) { | ||||
| MEM_SAFE_FREE(grid->name); | MEM_SAFE_FREE(grid->name); | ||||
| } | } | ||||
| BLI_freelistN(&graph->volume_grids); | BLI_freelistN(&graph->volume_grids); | ||||
| BLI_freelistN(&graph->textures); | BLI_freelistN(&graph->textures); | ||||
| BLI_freelistN(&graph->attributes); | BLI_freelistN(&graph->attributes); | ||||
| } | } | ||||
| /* Prune Unused Nodes */ | /* Prune Unused Nodes */ | ||||
| Show All 17 Lines | for (input = node->inputs.first; input; input = input->next) { | ||||
| if (input->link) { | if (input->link) { | ||||
| gpu_nodes_tag(input->link); | gpu_nodes_tag(input->link); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void gpu_node_graph_prune_unused(GPUNodeGraph *graph) | void gpu_node_graph_prune_unused(GPUNodeGraph *graph) | ||||
| { | { | ||||
| for (GPUNode *node = graph->nodes.first; node; node = node->next) { | LISTBASE_FOREACH (GPUNode *, node, &graph->nodes) { | ||||
| node->tag = false; | node->tag = false; | ||||
| } | } | ||||
| gpu_nodes_tag(graph->outlink); | gpu_nodes_tag(graph->outlink); | ||||
| for (GPUNode *node = graph->nodes.first, *next = NULL; node; node = next) { | for (GPUNode *node = graph->nodes.first, *next = NULL; node; node = next) { | ||||
| next = node->next; | next = node->next; | ||||
| Show All 28 Lines | |||||