Blender V4.3
source/blender/depsgraph/intern/builder/pipeline.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "pipeline.h"
6
7#include "BLI_time.h"
8
9#include "BKE_global.hh"
10
11#include "DNA_scene_types.h"
12
13#include "deg_builder_cycle.h"
14#include "deg_builder_nodes.h"
17
18namespace blender::deg {
19
21 : deg_graph_(reinterpret_cast<Depsgraph *>(graph)),
22 bmain_(deg_graph_->bmain),
23 scene_(deg_graph_->scene),
24 view_layer_(deg_graph_->view_layer)
25{
26}
27
29{
30 double start_time = 0.0;
32 start_time = BLI_time_now_seconds();
33 }
34
39
41 printf("Depsgraph built in %f seconds.\n", BLI_time_now_seconds() - start_time);
42 }
43}
44
51
53{
54 /* Generate all the nodes in the graph first */
55 unique_ptr<DepsgraphNodeBuilder> node_builder = construct_node_builder();
56 node_builder->begin_build();
57 build_nodes(*node_builder);
58 node_builder->end_build();
59}
60
62{
63 /* Hook up relationships between operations - to determine evaluation order. */
64 unique_ptr<DepsgraphRelationBuilder> relation_builder = construct_relation_builder();
65 relation_builder->begin_build();
66 build_relations(*relation_builder);
67 relation_builder->build_copy_on_write_relations();
68 relation_builder->build_driver_relations();
69}
70
72{
73 /* Detect and solve cycles. */
75 /* Simplify the graph by removing redundant relations (to optimize
76 * traversal later). */
77 /* TODO: it would be useful to have an option to disable this in cases where
78 * it is causing trouble. */
79 if (G.debug_value == 799) {
81 }
82 /* Store pointers to commonly used evaluated datablocks. */
84 /* Flush visibility layer and re-schedule nodes for update. */
86 DEG_graph_tag_on_visible_update(reinterpret_cast<::Depsgraph *>(deg_graph_), false);
87#if 0
89 printf("Consistency validation failed, ABORTING!\n");
90 abort();
91 }
92#endif
93 /* Relations are up to date. */
95}
96
97unique_ptr<DepsgraphNodeBuilder> AbstractBuilderPipeline::construct_node_builder()
98{
99 return std::make_unique<DepsgraphNodeBuilder>(bmain_, deg_graph_, &builder_cache_);
100}
101
102unique_ptr<DepsgraphRelationBuilder> AbstractBuilderPipeline::construct_relation_builder()
103{
104 return std::make_unique<DepsgraphRelationBuilder>(bmain_, deg_graph_, &builder_cache_);
105}
106
107} // namespace blender::deg
@ G_DEBUG_DEPSGRAPH_TIME
@ G_DEBUG_DEPSGRAPH_BUILD
#define BLI_assert(a)
Definition BLI_assert.h:50
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Platform independent time functions.
double BLI_time_now_seconds(void)
Definition time.c:65
void DEG_graph_tag_on_visible_update(Depsgraph *depsgraph, bool do_time)
bool DEG_debug_consistency_check(Depsgraph *graph)
virtual unique_ptr< DepsgraphRelationBuilder > construct_relation_builder()
virtual unique_ptr< DepsgraphNodeBuilder > construct_node_builder()
virtual void build_nodes(DepsgraphNodeBuilder &node_builder)=0
virtual void build_relations(DepsgraphRelationBuilder &relation_builder)=0
#define printf
#define G(x, y, z)
void deg_graph_transitive_reduction(Depsgraph *graph)
void deg_graph_detect_cycles(Depsgraph *graph)
void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
ListBase view_layers
ID * get_cow_id(const ID *id_orig) const
Definition depsgraph.cc:242