Commit: 729b68dcbd41503ef1c4a0f6c1ee21b9cb5fbcd6
Author: Joshua Leung
Date:   Thu Dec 18 16:55:49 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB729b68dcbd41503ef1c4a0f6c1ee21b9cb5fbcd6

Fixed logic for verify_entry_exit_ops()

This was assuming that there were relationships between nodes when checking for
inlinks and outlinks. However, since relationships are computed in a later pass,
there are always none, and it ends up nearly always adding unncessary entry/exit
noops (unless there's just a single op in the component).

===================================================================

M       source/blender/depsgraph/intern/depsgraph_build.cpp

===================================================================

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp 
b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 7f6e2aa..a2f4818 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -242,18 +242,23 @@ void 
DepsgraphNodeBuilder::verify_entry_exit_operations(ComponentDepsNode *node)
        /* cache these in a vector, so we don't invalidate the iterators
         * by adding operations inside the loop
         */
-       OperationsVector entry_ops, exit_ops;
+       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->inlinks.empty())
+               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->outlinks.empty())
+               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);
        }
        
        if (entry_ops.size() == 1) {
@@ -268,6 +273,14 @@ void 
DepsgraphNodeBuilder::verify_entry_exit_operations(ComponentDepsNode *node)
                        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
+       }
        
        if (exit_ops.size() == 1) {
                /* single exit op, just use this directly */
@@ -281,6 +294,14 @@ void 
DepsgraphNodeBuilder::verify_entry_exit_operations(ComponentDepsNode *node)
                        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
+       }
 }
 
 void DepsgraphNodeBuilder::verify_entry_exit_operations()

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to