[Bf-blender-cvs] [5dbeea9] master: Depsgraph: Avoid having per-node lock when scheduling children

Sergey Sharybin noreply at git.blender.org
Mon May 9 11:59:53 CEST 2016


Commit: 5dbeea95d0e1eb61eaa52dc5943d143f3b2e490c
Author: Sergey Sharybin
Date:   Mon May 9 11:58:36 2016 +0200
Branches: master
https://developer.blender.org/rB5dbeea95d0e1eb61eaa52dc5943d143f3b2e490c

Depsgraph: Avoid having per-node lock when scheduling children

Use atomic operations instead, should in theory improve timing of
scheduling. However, probably not so visible yet because actual
task scheduling still have some locks and memory allocations.

Baby steps, what would i say.

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

M	source/blender/depsgraph/intern/depsgraph_eval.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc
index fb6722c..15c8b1a 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -248,12 +248,8 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph, int layers,
 		}
 
 		if (node->num_links_pending == 0) {
-			BLI_spin_lock(&graph->lock);
-			bool need_schedule = !node->scheduled;
-			node->scheduled = true;
-			BLI_spin_unlock(&graph->lock);
-
-			if (need_schedule) {
+			bool is_scheduled = atomic_fetch_and_or_uint8((uint8_t*)&node->scheduled, (uint8_t)true);
+			if (!is_scheduled) {
 				if (node->is_noop()) {
 					/* skip NOOP node, schedule children right away */
 					schedule_children(pool, graph, node, layers);




More information about the Bf-blender-cvs mailing list