diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-09 12:58:36 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-09 12:58:36 +0300 |
commit | 5dbeea95d0e1eb61eaa52dc5943d143f3b2e490c (patch) | |
tree | 2812c6b6f65d03773f054537536719c3af587fa3 /source/blender | |
parent | dc5e02c42ce85f88c6ac089ecbe139404562f4a3 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_eval.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index fb6722cc893..15c8b1a9dd3 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); |