[Bf-blender-cvs] [55b24be] master: Depsgraph: Cleanup and code simplification

Sergey Sharybin noreply at git.blender.org
Fri May 27 18:09:08 CEST 2016


Commit: 55b24bef557922b8f51cf993b12047e980e43617
Author: Sergey Sharybin
Date:   Fri May 27 18:01:18 2016 +0200
Branches: master
https://developer.blender.org/rB55b24bef557922b8f51cf993b12047e980e43617

Depsgraph: Cleanup and code simplification

This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:

- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where

So in this commit the following changes are done:

- STL is prohibited, it's not really predictable on various compilers,
  with our BLI algorithms we can predict things much better.

  There are still few usages of std::vector, but that we'll be
  solving later once we've got similar thing in BLI.

- Simplify foreach loops, avoid using const_iterator all over the place.

- New directory layout, which is hopefully easier to follow.

- Some files were split, some of them will be split soon.

  The idea of this is to split huge functions into own files with
  good documentation and everything.

- Removed stuff which was planned for use in the future but was never
  finished, tested or anything.

  Let's wipe it out for now, and bring back once we really start using
  it, so it'll be more clear if it solves our needs.

- All the internal routines were moved to DEG namespace to separate
  them better from rest of blender.

  Some places now annoyingly using DEG::foo, but that we can olve by
  moving some utility functions inside of the namespace.

While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).

Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.

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

M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/DEG_depsgraph.h
M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/DEG_depsgraph_debug.h
M	source/blender/depsgraph/DEG_depsgraph_query.h
A	source/blender/depsgraph/intern/builder/deg_builder.cc
A	source/blender/depsgraph/intern/builder/deg_builder.h
A	source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
A	source/blender/depsgraph/intern/builder/deg_builder_cycle.h
A	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
A	source/blender/depsgraph/intern/builder/deg_builder_nodes.h
A	source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
A	source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
A	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
A	source/blender/depsgraph/intern/builder/deg_builder_relations.h
A	source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
A	source/blender/depsgraph/intern/builder/deg_builder_transitive.h
A	source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
M	source/blender/depsgraph/intern/depsgraph.cc
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_build.cc
D	source/blender/depsgraph/intern/depsgraph_build.h
D	source/blender/depsgraph/intern/depsgraph_build_nodes.cc
D	source/blender/depsgraph/intern/depsgraph_build_relations.cc
M	source/blender/depsgraph/intern/depsgraph_debug.cc
D	source/blender/depsgraph/intern/depsgraph_debug.h
M	source/blender/depsgraph/intern/depsgraph_eval.cc
M	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/depsgraph_query.cc
D	source/blender/depsgraph/intern/depsgraph_queue.cc
D	source/blender/depsgraph/intern/depsgraph_queue.h
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/depsgraph_type_defines.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
D	source/blender/depsgraph/intern/depsnode.cc
D	source/blender/depsgraph/intern/depsnode.h
D	source/blender/depsgraph/intern/depsnode_component.cc
D	source/blender/depsgraph/intern/depsnode_component.h
D	source/blender/depsgraph/intern/depsnode_opcodes.h
D	source/blender/depsgraph/intern/depsnode_operation.cc
D	source/blender/depsgraph/intern/depsnode_operation.h
A	source/blender/depsgraph/intern/eval/deg_eval.cc
A	source/blender/depsgraph/intern/eval/deg_eval.h
A	source/blender/depsgraph/intern/eval/deg_eval_debug.cc
A	source/blender/depsgraph/intern/eval/deg_eval_debug.h
A	source/blender/depsgraph/intern/eval/deg_eval_flush.cc
A	source/blender/depsgraph/intern/eval/deg_eval_flush.h
A	source/blender/depsgraph/intern/nodes/deg_node.cc
A	source/blender/depsgraph/intern/nodes/deg_node.h
A	source/blender/depsgraph/intern/nodes/deg_node_component.cc
A	source/blender/depsgraph/intern/nodes/deg_node_component.h
A	source/blender/depsgraph/intern/nodes/deg_node_operation.cc
A	source/blender/depsgraph/intern/nodes/deg_node_operation.h
A	source/blender/depsgraph/util/deg_util_foreach.h
A	source/blender/depsgraph/util/deg_util_function.h
A	source/blender/depsgraph/util/deg_util_hash.h
D	source/blender/depsgraph/util/depsgraph_util_cycle.cc
D	source/blender/depsgraph/util/depsgraph_util_cycle.h
D	source/blender/depsgraph/util/depsgraph_util_foreach.h
D	source/blender/depsgraph/util/depsgraph_util_function.h
D	source/blender/depsgraph/util/depsgraph_util_hash.h
D	source/blender/depsgraph/util/depsgraph_util_map.h
D	source/blender/depsgraph/util/depsgraph_util_pchanmap.cc
D	source/blender/depsgraph/util/depsgraph_util_pchanmap.h
D	source/blender/depsgraph/util/depsgraph_util_set.h
D	source/blender/depsgraph/util/depsgraph_util_transitive.cc
D	source/blender/depsgraph/util/depsgraph_util_transitive.h

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

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 2b4df85..fd2a521 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -25,8 +25,6 @@
 
 set(INC
 	.
-	intern
-	util
 	../blenkernel
 	../blenlib
 	../bmesh
@@ -42,45 +40,50 @@ set(INC_SYS
 )
 
 set(SRC
+	intern/builder/deg_builder.cc
+	intern/builder/deg_builder_cycle.cc
+	intern/builder/deg_builder_nodes.cc
+	intern/builder/deg_builder_pchanmap.cc
+	intern/builder/deg_builder_relations.cc
+	intern/builder/deg_builder_transitive.cc
+	intern/debug/deg_debug_graphviz.cc
+	intern/eval/deg_eval.cc
+	intern/eval/deg_eval_debug.cc
+	intern/eval/deg_eval_flush.cc
+	intern/nodes/deg_node.cc
+	intern/nodes/deg_node_component.cc
+	intern/nodes/deg_node_operation.cc
 	intern/depsgraph.cc
-	intern/depsnode.cc
-	intern/depsnode_component.cc
-	intern/depsnode_operation.cc
 	intern/depsgraph_build.cc
-	intern/depsgraph_build_nodes.cc
-	intern/depsgraph_build_relations.cc
 	intern/depsgraph_debug.cc
 	intern/depsgraph_eval.cc
 	intern/depsgraph_query.cc
-	intern/depsgraph_queue.cc
 	intern/depsgraph_tag.cc
 	intern/depsgraph_type_defines.cc
-	util/depsgraph_util_cycle.cc
-	util/depsgraph_util_pchanmap.cc
-	util/depsgraph_util_transitive.cc
 
 	DEG_depsgraph.h
 	DEG_depsgraph_build.h
 	DEG_depsgraph_debug.h
 	DEG_depsgraph_query.h
+
+	intern/builder/deg_builder.h
+	intern/builder/deg_builder_cycle.h
+	intern/builder/deg_builder_nodes.h
+	intern/builder/deg_builder_pchanmap.h
+	intern/builder/deg_builder_relations.h
+	intern/builder/deg_builder_transitive.h
+	intern/eval/deg_eval.h
+	intern/eval/deg_eval_debug.h
+	intern/eval/deg_eval_flush.h
+	intern/nodes/deg_node.h
+	intern/nodes/deg_node_component.h
+	intern/nodes/deg_node_operation.h
 	intern/depsgraph.h
-	intern/depsnode.h
-	intern/depsnode_component.h
-	intern/depsnode_operation.h
-	intern/depsnode_opcodes.h
-	intern/depsgraph_build.h
-	intern/depsgraph_debug.h
 	intern/depsgraph_intern.h
-	intern/depsgraph_queue.h
 	intern/depsgraph_types.h
 
-	util/depsgraph_util_cycle.h
-	util/depsgraph_util_function.h
-	util/depsgraph_util_hash.h
-	util/depsgraph_util_map.h
-	util/depsgraph_util_pchanmap.h
-	util/depsgraph_util_set.h
-	util/depsgraph_util_transitive.h
+	util/deg_util_function.h
+	util/deg_util_hash.h
 )
 
 if(WITH_CXX11)
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index f37ba71..d1de83e 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -131,9 +131,6 @@ void DEG_ids_clear_recalc(struct Main *bmain);
 
 /* Update Flushing ------------------------------- */
 
-/* Flush updates */
-void DEG_graph_flush_updates(struct Main *bmain, Depsgraph *graph);
-
 /* Flush updates for all IDs */
 void DEG_ids_flush_tagged(struct Main *bmain);
 
@@ -144,11 +141,6 @@ void DEG_ids_check_recalc(struct Main *bmain,
                           struct Scene *scene,
                           bool time);
 
-/* Clear all update tags
- * - For aborted updates, or after successful evaluation
- */
-void DEG_graph_clear_tags(Depsgraph *graph);
-
 /* ************************************************ */
 /* Evaluation Engine API */
 
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index f680c47..49b648c 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -43,9 +43,6 @@ struct Depsgraph;
 struct Main;
 struct Scene;
 
-struct PointerRNA;
-struct PropertyRNA;
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 374fad6..0d19b8e 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -39,13 +39,10 @@
 extern "C" {
 #endif
 
-struct DepsgraphSettings;
 struct GHash;
 struct ID;
 
 struct Depsgraph;
-struct DepsNode;
-struct DepsRelation;
 
 /* ************************************************ */
 /* Statistics */
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 60d673d..ccd204a 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -19,7 +19,7 @@
  * All rights reserved.
  *
  * Original Author: Joshua Leung
- * Contributor(s): None Yet
+ * Contributor(s): Sergey Sharybin
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -33,155 +33,14 @@
 #ifndef __DEG_DEPSGRAPH_QUERY_H__
 #define __DEG_DEPSGRAPH_QUERY_H__
 
-struct ListBase;
 struct ID;
 
 struct Depsgraph;
-struct DepsNode;
-struct DepsRelation;
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/* ************************************************ */
-/* Type Defines */
-
-/* FilterPredicate Callback 
- *
- * Defines a callback function which can be supplied to check whether a 
- * node is relevant or not.
- *
- * < graph: Depsgraph that we're traversing
- * < node: The node to check
- * < userdata: FilterPredicate state data (as needed)
- * > returns: True if node is relevant
- */
-typedef bool (*DEG_FilterPredicate)(const struct Depsgraph *graph, const struct DepsNode *node, void *userdata);
-
-
-/* Node Operation 
- *
- * Performs some action on the given node, provided that the node was
- * deemed to be relevant to operate on.
- *
- * < graph: Depsgraph that we're traversing
- * < node: The node to perform operation on/with
- * < userdata: Node Operation's state data (as needed)
- * > returns: True if traversal should be aborted at this point
- */
-typedef bool (*DEG_NodeOperation)(const struct Depsgraph *graph, struct DepsNode *node, void *userdata);
-
-/* ************************************************ */
-/* Low-Level Filtering API */
-
-/* Create a filtered copy of the given graph which contains only the
- * nodes which fulfill the criteria specified using the FilterPredicate
- * passed in.
- *
- * < graph: The graph to be copied and filtered
- * < filter: FilterPredicate used to check which nodes should be included
- *           (If null, full graph is copied as-is)
- * < userdata: State data for filter (as necessary)
- *
- * > returns: a full copy of all the relevant nodes - the matching subgraph
- */
-// XXX: is there any need for extra settings/options for how the filtering goes?
-Depsgraph *DEG_graph_filter(const struct Depsgraph *graph, DEG_FilterPredicate *filter, void *userdata);
-
-
-/* Traverse nodes in graph which are deemed relevant,
- * performing the provided operation on the nodes.
- *
- * < graph: The graph to perform operations on
- * < filter: FilterPredicate used to check which nodes should be included
- *           (If null, all nodes are considered valid targets)
- * < filter_data: Custom state data for FilterPredicate
- *                (Note: This can be the same as op_data, where appropriate)
- * < op: NodeOperation to perform on each node
- *       (If null, no graph traversal is performed for efficiency)
- * < op_data: Custom state data for NodeOperation
- *            (Note: This can be the same as filter_data, where appropriate)
- */
-void DEG_graph_traverse(const struct Depsgraph *graph,
-                        DEG_FilterPredicate *filter, void *filter_data,
-                        DEG_NodeOperation *op, void *op_data);
-
-/* ************************************************ */
-/* Node-Based Operations */
-// XXX: do we want to be able to attach conditional requirements here?
-
-/* Find an (outer) node matching given conditions 
- * ! Assumes that there will only be one such node, or that only the first one matters
- *
- * < graph: a dependency graph which may or may not contain a node matching these requirements
- * < query: query conditions for the criteria that the node must satisfy 
- */
-//DepsNode *DEG_node_find(const Depsgraph *graph, DEG_QueryConditions *query);
-
-/* Topology Queries (Direct) ---------------------- */
-
-/* Get list of nodes which directly depend on given node  
- *
- * > result: list to write results to
- * < node: the node to find the children/dependents of
- */
-void DEG_node_get_children(struct ListBase *result, const struct DepsNode *node);
-
-
-/* Get list of nodes which given node directly depends on 
- *
- * > result: list to write results to
- * < node: the node to find the dependencies of
- */
-void DEG_node_get_dependencies(struct ListBase *result, const struct DepsNode *node);
-
-
-/* Topology Queries (Subgraph) -------------------- */
-// XXX: given that subgraphs potentially involve many interconnected nodes, we currently
-//      just spit out a copy of the subgraph which matches. This works well for the cases
-//      where these are used - mostly for efficient updating of subsets of the nodes.
-
-// XXX: allow supplying a filter predicate to provide further filtering/pruning?
-
-
-/* Get all descendants of a node
- *
- * That is, get the subgraph / subset of nodes which are dependent
- * on the results of the given node.
- */
-Depsgraph *DEG_node_get_descendants(const struct Depsgraph *graph, const struct DepsNode *node);
-
-
-/* Get all ancestors of a node 
- *
- * That is, get the subgraph / subset of nodes which the given node
- * is dependent on in order to be evaluated.
- */
-Depsgraph *DEG_node_get_ancestors(const struct Depsgraph *graph, const struct DepsNode *node);
-
-/* ************************************************ */
-/* Higher-Level Queries */
-
-/* Get ID-blocks which would be affected if specified ID is modified 
- * < only_direct: True = Only ID-blocks with direct relationships to ID-block will be returned
- *
- * > result: (LinkData : ID) a list of ID-blocks matching the specified criteria
- * > returns: number of matching ID-blocks
- */
-size_t DEG_query_affected_ids(struct ListBase *result, const struct ID *id, const bool only_direct);
-
-
-/* Get ID-blocks which are needed to update/evaluate specified ID 
- * < only_direct: True = Only ID-blocks with direct relationships to ID-block will be returned
- *
- * > result: (LinkData : ID) a list of ID-blocks matching the specified criteria
- * > returns: number of matching ID-blocks

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list