diff options
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.cc | 55 |
1 files changed, 12 insertions, 43 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 98b10718404..15ad6b8054d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -38,11 +38,6 @@ #include "BLI_task.h" #include "BLI_ghash.h" -extern "C" { -#include "BKE_depsgraph.h" -#include "BKE_global.h" -} /* extern "C" */ - #include "DEG_depsgraph.h" #include "atomic_ops.h" @@ -73,13 +68,11 @@ namespace DEG { static void schedule_children(TaskPool *pool, Depsgraph *graph, OperationDepsNode *node, - const unsigned int layers, const int thread_id); struct DepsgraphEvalState { EvaluationContext *eval_ctx; Depsgraph *graph; - unsigned int layers; }; static void deg_task_run_func(TaskPool *pool, @@ -127,39 +120,31 @@ static void deg_task_run_func(TaskPool *pool, } BLI_task_pool_delayed_push_begin(pool, thread_id); - schedule_children(pool, state->graph, node, state->layers, thread_id); + schedule_children(pool, state->graph, node, thread_id); BLI_task_pool_delayed_push_end(pool, thread_id); } typedef struct CalculatePengindData { Depsgraph *graph; - unsigned int layers; } CalculatePengindData; static void calculate_pending_func(void *data_v, int i) { CalculatePengindData *data = (CalculatePengindData *)data_v; Depsgraph *graph = data->graph; - unsigned int layers = data->layers; OperationDepsNode *node = graph->operations[i]; - IDDepsNode *id_node = node->owner->owner; node->num_links_pending = 0; node->scheduled = false; /* count number of inputs that need updates */ - if ((id_node->layers & layers) != 0 && - (node->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0) - { + if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0) { foreach (DepsRelation *rel, node->inlinks) { if (rel->from->type == DEG_NODE_TYPE_OPERATION && (rel->flag & DEPSREL_FLAG_CYCLIC) == 0) { OperationDepsNode *from = (OperationDepsNode *)rel->from; - IDDepsNode *id_from_node = from->owner->owner; - if ((id_from_node->layers & layers) != 0 && - (from->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0) - { + if ((from->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0) { ++node->num_links_pending; } } @@ -167,13 +152,12 @@ static void calculate_pending_func(void *data_v, int i) } } -static void calculate_pending_parents(Depsgraph *graph, unsigned int layers) +static void calculate_pending_parents(Depsgraph *graph) { const int num_operations = graph->operations.size(); const bool do_threads = num_operations > 256; CalculatePengindData data; data.graph = graph; - data.layers = layers; BLI_task_parallel_range(0, num_operations, &data, @@ -212,15 +196,11 @@ static void calculate_eval_priority(OperationDepsNode *node) * dec_parents: Decrement pending parents count, true when child nodes are * scheduled after a task has been completed. */ -static void schedule_node(TaskPool *pool, Depsgraph *graph, unsigned int layers, +static void schedule_node(TaskPool *pool, Depsgraph *graph, OperationDepsNode *node, bool dec_parents, const int thread_id) { - unsigned int id_layers = node->owner->owner->layers; - - if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0 && - (id_layers & layers) != 0) - { + if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0) { if (dec_parents) { BLI_assert(node->num_links_pending > 0); atomic_sub_and_fetch_uint32(&node->num_links_pending, 1); @@ -232,7 +212,7 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph, unsigned int layers, if (!is_scheduled) { if (node->is_noop()) { /* skip NOOP node, schedule children right away */ - schedule_children(pool, graph, node, layers, thread_id); + schedule_children(pool, graph, node, thread_id); } else { /* children are scheduled once this task is completed */ @@ -248,19 +228,16 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph, unsigned int layers, } } -static void schedule_graph(TaskPool *pool, - Depsgraph *graph, - const unsigned int layers) +static void schedule_graph(TaskPool *pool, Depsgraph *graph) { foreach (OperationDepsNode *node, graph->operations) { - schedule_node(pool, graph, layers, node, false, 0); + schedule_node(pool, graph, node, false, 0); } } static void schedule_children(TaskPool *pool, Depsgraph *graph, OperationDepsNode *node, - const unsigned int layers, const int thread_id) { foreach (DepsRelation *rel, node->outlinks) { @@ -272,7 +249,6 @@ static void schedule_children(TaskPool *pool, } schedule_node(pool, graph, - layers, child, (rel->flag & DEPSREL_FLAG_CYCLIC) == 0, thread_id); @@ -287,8 +263,7 @@ static void schedule_children(TaskPool *pool, * \note Time sources should be all valid! */ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, - Depsgraph *graph, - const unsigned int layers) + Depsgraph *graph) { /* Generate base evaluation context, upon which all the others are derived. */ // TODO: this needs both main and scene access... @@ -298,11 +273,6 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, 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; @@ -311,7 +281,6 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, DepsgraphEvalState state; state.eval_ctx = eval_ctx; state.graph = graph; - state.layers = layers; TaskScheduler *task_scheduler; bool need_free_scheduler; @@ -327,7 +296,7 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, TaskPool *task_pool = BLI_task_pool_create_suspended(task_scheduler, &state); - calculate_pending_parents(graph, layers); + calculate_pending_parents(graph); /* Clear tags. */ foreach (OperationDepsNode *node, graph->operations) { @@ -343,7 +312,7 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, DepsgraphDebug::eval_begin(eval_ctx); - schedule_graph(task_pool, graph, layers); + schedule_graph(task_pool, graph); BLI_task_pool_work_and_wait(task_pool); BLI_task_pool_free(task_pool); |