[Bf-blender-cvs] [b7121639e94] master: Depsgraph: Simplify some functions in evaluaiton
Sergey Sharybin
noreply at git.blender.org
Thu Dec 21 16:33:35 CET 2017
Commit: b7121639e9479d10e408e2720c52f80fb9cf5f13
Author: Sergey Sharybin
Date: Thu Dec 21 12:32:32 2017 +0100
Branches: master
https://developer.blender.org/rBb7121639e9479d10e408e2720c52f80fb9cf5f13
Depsgraph: Simplify some functions in evaluaiton
===================================================================
M source/blender/depsgraph/intern/eval/deg_eval.cc
===================================================================
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 20f15a708ae..c5100856e83 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -143,6 +143,15 @@ static void calculate_pending_parents(Depsgraph *graph, unsigned int layers)
do_threads);
}
+static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
+{
+ calculate_pending_parents(graph, state->layers);
+ /* Clear tags and other things which needs to be clear. */
+ foreach (OperationDepsNode *node, graph->operations) {
+ node->done = 0;
+ }
+}
+
/* Schedule a node if it needs evaluation.
* dec_parents: Decrement pending parents count, true when child nodes are
* scheduled after a task has been completed.
@@ -225,32 +234,25 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
Depsgraph *graph,
const unsigned int layers)
{
- /* Generate base evaluation context, upon which all the others are derived. */
- // TODO: this needs both main and scene access...
-
/* Nothing to update, early out. */
if (BLI_gset_size(graph->entry_tags) == 0) {
return;
}
-
DEG_DEBUG_PRINTF("%s: layers:%u, graph->layers:%u\n",
__func__,
layers,
graph->layers);
-
/* Set time for the current graph evaluation context. */
TimeSourceDepsNode *time_src = graph->find_time_source();
eval_ctx->ctime = time_src->cfra;
-
- /* XXX could use a separate pool for each eval context */
+ /* Set up evaluation context for depsgraph itself. */
DepsgraphEvalState state;
state.eval_ctx = eval_ctx;
state.graph = graph;
state.layers = layers;
-
+ /* Set up task scheduler and pull for threaded evaluation. */
TaskScheduler *task_scheduler;
bool need_free_scheduler;
-
if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) {
task_scheduler = BLI_task_scheduler_create(1);
need_free_scheduler = true;
@@ -259,24 +261,15 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
task_scheduler = BLI_task_scheduler_get();
need_free_scheduler = false;
}
-
TaskPool *task_pool = BLI_task_pool_create_suspended(task_scheduler, &state);
-
- calculate_pending_parents(graph, layers);
-
- /* Clear tags. */
- foreach (OperationDepsNode *node, graph->operations) {
- node->done = 0;
- }
-
+ /* Prepare all nodes for evaluation. */
+ initialize_execution(&state, graph);
+ /* Do actual evaluation now. */
schedule_graph(task_pool, graph, layers);
-
BLI_task_pool_work_and_wait(task_pool);
BLI_task_pool_free(task_pool);
-
/* Clear any uncleared tags - just in case. */
deg_graph_clear_tags(graph);
-
if (need_free_scheduler) {
BLI_task_scheduler_free(task_scheduler);
}
More information about the Bf-blender-cvs
mailing list