[Bf-blender-cvs] [6ef4418] depsgraph_refactor: Get rid of verify_entry_exit_operations()
Joshua Leung
noreply at git.blender.org
Tue Dec 30 10:26:20 CET 2014
Commit: 6ef44184a292504a7fa7edd41a3a16e9b91f6308
Author: Joshua Leung
Date: Tue Dec 30 13:19:25 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB6ef44184a292504a7fa7edd41a3a16e9b91f6308
Get rid of verify_entry_exit_operations()
This was a holdover from the initial implementation, when we tried to do
everything in a single pass, and we couldn't be sure if a component's
start/end operations had been created yet (i.e. since some components
may have only been partially created).
Following discussion with Sergey, we've concluded that this is redundant
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.cpp
M source/blender/depsgraph/intern/depsgraph_build.h
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 24ca414..c99ea5a 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -233,103 +233,11 @@ OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(ID *id, eDepsNode_Ty
OperationDepsNode *op_node = comp_node->add_operation(optype, op, opcode, description);
m_graph->operations.push_back(op_node);
- return op_node;
-}
-
-void DepsgraphNodeBuilder::verify_entry_exit_operations(ComponentDepsNode *node)
-{
- typedef std::vector<OperationDepsNode*> OperationsVector;
-
- /* cache these in a vector, so we don't invalidate the iterators
- * by adding operations inside the loop
- */
- OperationsVector source_ops, sink_ops; /* nodes without any links (i.e. all of them when this gets called) */
- OperationsVector entry_ops, exit_ops; /* nodes tagged as being entry/exit points */
-
- for (ComponentDepsNode::OperationMap::const_iterator it = node->operations.begin(); it != node->operations.end(); ++it) {
- OperationDepsNode *op_node = it->second;
-
- /* entry node? */
- if (op_node->optype == DEPSOP_TYPE_INIT)
- entry_ops.push_back(op_node);
- else if (op_node->inlinks.empty())
- source_ops.push_back(op_node);
-
- /* exit node? */
- if (op_node->optype == DEPSOP_TYPE_POST)
- exit_ops.push_back(op_node);
- else if (op_node->outlinks.empty())
- sink_ops.push_back(op_node);
- }
+ // TODO: mark as entry/exit if appropriate
- if (entry_ops.size() == 1) {
- /* single entry op, just use this directly */
- node->entry_operation = entry_ops.front();
- }
- else if (entry_ops.size() > 1) {
- /* multiple entry ops, add a barrier node as a single entry point */
- node->entry_operation = add_operation_node(node, DEPSOP_TYPE_INIT, NULL, DEG_OPCODE_NOOP, "Entry");
- for (OperationsVector::const_iterator it = entry_ops.begin(); it != entry_ops.end(); ++it) {
- OperationDepsNode *op_node = *it;
- m_graph->add_new_relation(node->entry_operation, op_node, DEPSREL_TYPE_OPERATION, "Component entry relation");
- }
- }
- else if (source_ops.size() == 1) {
- /* single unlinked op, just use directly */
- node->entry_operation = source_ops.front();
- }
- else if (source_ops.size() > 1) {
- /* multiple unlinked op, add a barrier node as a single entry point */
- // XXX: problematic for drivers
- node->entry_operation = add_operation_node(node, DEPSOP_TYPE_INIT, NULL, DEG_OPCODE_NOOP, "Entry");
- for (OperationsVector::const_iterator it = source_ops.begin(); it != source_ops.end(); ++it) {
- OperationDepsNode *op_node = *it;
- m_graph->add_new_relation(node->entry_operation, op_node, DEPSREL_TYPE_OPERATION, "Component entry relation");
- }
- }
-
- if (exit_ops.size() == 1) {
- /* single exit op, just use this directly */
- node->exit_operation = exit_ops.front();
- }
- else if (exit_ops.size() > 1) {
- /* multiple exit ops, add a barrier node as a single exit point */
- node->exit_operation = add_operation_node(node, DEPSOP_TYPE_OUT, NULL, DEG_OPCODE_NOOP, "Exit");
- for (OperationsVector::const_iterator it = exit_ops.begin(); it != exit_ops.end(); ++it) {
- OperationDepsNode *op_node = *it;
- m_graph->add_new_relation(op_node, node->exit_operation, DEPSREL_TYPE_OPERATION, "Component exit relation");
- }
- }
- else if (sink_ops.size() == 1) {
- /* single unlinked op, just use this directly */
- node->exit_operation = sink_ops.front();
- }
- else if (sink_ops.size() > 1) {
- /* multiple unlinked ops, add a barrier node as a single exit point */
- // XXX: problematic for drivers
- node->exit_operation = add_operation_node(node, DEPSOP_TYPE_OUT, NULL, DEG_OPCODE_NOOP, "Exit");
- for (OperationsVector::const_iterator it = sink_ops.begin(); it != sink_ops.end(); ++it) {
- OperationDepsNode *op_node = *it;
- m_graph->add_new_relation(op_node, node->exit_operation, DEPSREL_TYPE_OPERATION, "Component exit relation");
- }
- }
-
- BLI_assert(node->operations.size() == 0 || node->entry_operation != NULL);
- BLI_assert(node->operations.size() == 0 || node->exit_operation != NULL);
-}
-
-void DepsgraphNodeBuilder::verify_entry_exit_operations()
-{
- for (Depsgraph::IDNodeMap::const_iterator it_id = m_graph->id_hash.begin(); it_id != m_graph->id_hash.end(); ++it_id) {
- IDDepsNode *id_node = it_id->second;
- for (IDDepsNode::ComponentMap::const_iterator it_comp = id_node->components.begin(); it_comp != id_node->components.end(); ++it_comp) {
- ComponentDepsNode *comp_node = it_comp->second;
- verify_entry_exit_operations(comp_node);
- }
- }
+ return op_node;
}
-
/* ************************************************* */
/* Relations Builder */
@@ -587,10 +495,6 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
node_builder.add_root_node();
node_builder.build_scene(scene);
- // XXX: this exists, but may break some other cases later...
- node_builder.verify_entry_exit_operations();
-
-
DepsgraphRelationBuilder relation_builder(graph);
/* hook scene up to the root node as entrypoint to graph */
/* XXX what does this relation actually mean?
@@ -599,13 +503,6 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
//relation_builder.add_relation(RootKey(), IDKey(scene), DEPSREL_TYPE_ROOT_TO_ACTIVE, "Root to Active Scene");
relation_builder.build_scene(scene);
- /* only now add entry/exit nodes, now that we know what relations each node will have */
- //node_builder.verify_entry_exit_operations();
-
-#if 0
- /* sort nodes to determine evaluation order (in most cases) */
- DEG_graph_sort(graph);
-#endif
deg_graph_transitive_reduction(graph);
deg_graph_flush_node_layers(graph);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 6f2bd6c..3f5518c 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -77,8 +77,6 @@ struct DepsgraphNodeBuilder {
return add_operation_node(id, comp_type, "", optype, op, opcode, description);
}
- void verify_entry_exit_operations();
-
void build_scene(Scene *scene);
SubgraphDepsNode *build_subgraph(Group *group);
void build_group(Group *group);
@@ -104,9 +102,6 @@ struct DepsgraphNodeBuilder {
void build_world(World *world);
void build_compositor(Scene *scene);
-protected:
- void verify_entry_exit_operations(ComponentDepsNode *node);
-
private:
Main *m_bmain;
Depsgraph *m_graph;
More information about the Bf-blender-cvs
mailing list