Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-12-21 14:32:32 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-12-21 18:33:22 +0300
commitb7121639e9479d10e408e2720c52f80fb9cf5f13 (patch)
tree0b5b30ff2c6c0bef5579b15a7f1205b63eb12997
parentf0a5dc63ff0d4196f2d96b9dd846305834520f95 (diff)
Depsgraph: Simplify some functions in evaluaiton
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.cc35
1 files changed, 14 insertions, 21 deletions
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);
}