From e00a027c1e01396de9fa141965e57a0e6c1dc1cd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 Jul 2022 11:18:30 +0200 Subject: Depsgraph: Use single task pool during evaluation Not sure why multiple pools were created: the pool should be able to handle two sets of tasks. Perhaps non-measurable improvement in terms of performance but this change simplifies code a bit. --- source/blender/depsgraph/intern/eval/deg_eval.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 2d9d40aede6..64334e95c4c 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -361,27 +361,29 @@ void deg_evaluate_on_refresh(Depsgraph *graph) graph->is_evaluating = true; depsgraph_ensure_view_layer(graph); + /* Set up evaluation state. */ DepsgraphEvalState state; state.graph = graph; state.do_stats = graph->debug.do_time_debug(); state.need_single_thread_pass = false; + /* Prepare all nodes for evaluation. */ initialize_execution(&state, graph); + TaskPool *task_pool = deg_evaluate_task_pool_create(&state); + /* Do actual evaluation now. */ /* First, process all Copy-On-Write nodes. */ state.stage = EvaluationStage::COPY_ON_WRITE; - TaskPool *task_pool = deg_evaluate_task_pool_create(&state); schedule_graph(&state, schedule_node_to_pool, task_pool); BLI_task_pool_work_and_wait(task_pool); - BLI_task_pool_free(task_pool); /* After that, process all other nodes. */ state.stage = EvaluationStage::THREADED_EVALUATION; - task_pool = deg_evaluate_task_pool_create(&state); schedule_graph(&state, schedule_node_to_pool, task_pool); BLI_task_pool_work_and_wait(task_pool); + BLI_task_pool_free(task_pool); if (state.need_single_thread_pass) { @@ -395,6 +397,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph) if (state.do_stats) { deg_eval_stats_aggregate(graph); } + /* Clear any uncleared tags - just in case. */ deg_graph_clear_tags(graph); graph->is_evaluating = false; -- cgit v1.2.3