Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/eval/deg_eval.cc
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
| void schedule_children(DepsgraphEvalState *state, | void schedule_children(DepsgraphEvalState *state, | ||||
| OperationNode *node, | OperationNode *node, | ||||
| const int thread_id, | const int thread_id, | ||||
| ScheduleFunction *schedule_function, | ScheduleFunction *schedule_function, | ||||
| ScheduleFunctionArgs... schedule_function_args); | ScheduleFunctionArgs... schedule_function_args); | ||||
| void schedule_node_to_pool(OperationNode *node, const int thread_id, TaskPool *pool) | void schedule_node_to_pool(OperationNode *node, const int thread_id, TaskPool *pool) | ||||
| { | { | ||||
| BLI_task_pool_push_from_thread( | BLI_task_pool_push_from_thread(pool, deg_task_run_func, node, false, NULL, thread_id); | ||||
| pool, deg_task_run_func, node, false, TASK_PRIORITY_HIGH, thread_id); | |||||
| } | } | ||||
| /* Denotes which part of dependency graph is being evaluated. */ | /* Denotes which part of dependency graph is being evaluated. */ | ||||
| enum class EvaluationStage { | enum class EvaluationStage { | ||||
| /* Stage 1: Only Copy-on-Write operations are to be evaluated, prior to anything else. | /* Stage 1: Only Copy-on-Write operations are to be evaluated, prior to anything else. | ||||
| * This allows other operations to access its dependencies when there is a dependency cycle | * This allows other operations to access its dependencies when there is a dependency cycle | ||||
| * involved. */ | * involved. */ | ||||
| COPY_ON_WRITE, | COPY_ON_WRITE, | ||||
| ▲ Show 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | void deg_evaluate_on_refresh(Depsgraph *graph) | ||||
| if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) { | if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) { | ||||
| task_scheduler = BLI_task_scheduler_create(1); | task_scheduler = BLI_task_scheduler_create(1); | ||||
| need_free_scheduler = true; | need_free_scheduler = true; | ||||
| } | } | ||||
| else { | else { | ||||
| task_scheduler = BLI_task_scheduler_get(); | task_scheduler = BLI_task_scheduler_get(); | ||||
| need_free_scheduler = false; | need_free_scheduler = false; | ||||
| } | } | ||||
| TaskPool *task_pool = BLI_task_pool_create_suspended(task_scheduler, &state); | TaskPool *task_pool = BLI_task_pool_create_suspended(task_scheduler, &state, TASK_PRIORITY_HIGH); | ||||
| /* Prepare all nodes for evaluation. */ | /* Prepare all nodes for evaluation. */ | ||||
| initialize_execution(&state, graph); | initialize_execution(&state, graph); | ||||
| /* Do actual evaluation now. */ | /* Do actual evaluation now. */ | ||||
| /* First, process all Copy-On-Write nodes. */ | /* First, process all Copy-On-Write nodes. */ | ||||
| state.stage = EvaluationStage::COPY_ON_WRITE; | state.stage = EvaluationStage::COPY_ON_WRITE; | ||||
| schedule_graph(&state, schedule_node_to_pool, task_pool); | schedule_graph(&state, schedule_node_to_pool, task_pool); | ||||
| Show All 30 Lines | |||||