Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/eval/deg_eval_flush.cc
| Context not available. | |||||
| namespace { | namespace { | ||||
| void flush_init_operation_node_func(void *__restrict data_v, | |||||
| const int i, | |||||
| const TaskParallelTLS *__restrict /*tls*/) | |||||
| { | |||||
| Depsgraph *graph = (Depsgraph *)data_v; | |||||
| OperationNode *node = graph->operations[i]; | |||||
| node->scheduled = false; | |||||
| } | |||||
| void flush_init_id_node_func(void *__restrict data_v, | void flush_init_id_node_func(void *__restrict data_v, | ||||
| const int i, | const int i, | ||||
| const TaskParallelTLS *__restrict /*tls*/) | const TaskParallelTLS *__restrict /*tls*/) | ||||
| Context not available. | |||||
| BLI_INLINE void flush_prepare(Depsgraph *graph) | BLI_INLINE void flush_prepare(Depsgraph *graph) | ||||
| { | { | ||||
| for (OperationNode *node : graph->operations) { | { | ||||
| node->scheduled = false; | const int num_operations = graph->operations.size(); | ||||
| TaskParallelSettings settings; | |||||
| BLI_parallel_range_settings_defaults(&settings); | |||||
| settings.min_iter_per_thread = 1024; | |||||
| BLI_task_parallel_range(0, num_operations, graph, flush_init_operation_node_func, &settings); | |||||
| } | } | ||||
| { | { | ||||
| const int num_id_nodes = graph->id_nodes.size(); | const int num_id_nodes = graph->id_nodes.size(); | ||||
| TaskParallelSettings settings; | TaskParallelSettings settings; | ||||
| Context not available. | |||||
| BLI_assert(bmain != NULL); | BLI_assert(bmain != NULL); | ||||
| BLI_assert(graph != NULL); | BLI_assert(graph != NULL); | ||||
| /* Nothing to update, early out. */ | /* Nothing to update, early out. */ | ||||
| if (BLI_gset_len(graph->entry_tags) == 0 && !graph->need_update_time) { | |||||
| return; | |||||
| } | |||||
| if (graph->need_update_time) { | if (graph->need_update_time) { | ||||
| const Scene *scene_orig = graph->scene; | const Scene *scene_orig = graph->scene; | ||||
| const float ctime = BKE_scene_frame_get(scene_orig); | const float ctime = BKE_scene_frame_get(scene_orig); | ||||
| Context not available. | |||||
| graph->ctime = ctime; | graph->ctime = ctime; | ||||
| time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME); | time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME); | ||||
| } | } | ||||
| if (BLI_gset_len(graph->entry_tags) == 0) { | |||||
| return; | |||||
| } | |||||
| /* Reset all flags, get ready for the flush. */ | /* Reset all flags, get ready for the flush. */ | ||||
| flush_prepare(graph); | flush_prepare(graph); | ||||
| /* Starting from the tagged "entry" nodes, flush outwards. */ | /* Starting from the tagged "entry" nodes, flush outwards. */ | ||||
| Context not available. | |||||
| invalidate_tagged_evaluated_data(graph); | invalidate_tagged_evaluated_data(graph); | ||||
| } | } | ||||
| static void graph_clear_operation_func(void *__restrict data_v, | |||||
| const int i, | |||||
| const TaskParallelTLS *__restrict /*tls*/) | |||||
| { | |||||
| Depsgraph *graph = (Depsgraph *)data_v; | |||||
| OperationNode *node = graph->operations[i]; | |||||
| /* Clear node's "pending update" settings. */ | |||||
| node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE | | |||||
| DEPSOP_FLAG_USER_MODIFIED); | |||||
| } | |||||
| /* Clear tags from all operation nodes. */ | /* Clear tags from all operation nodes. */ | ||||
| void deg_graph_clear_tags(Depsgraph *graph) | void deg_graph_clear_tags(Depsgraph *graph) | ||||
| { | { | ||||
| /* Go over all operation nodes, clearing tags. */ | /* Go over all operation nodes, clearing tags. */ | ||||
| for (OperationNode *node : graph->operations) { | { | ||||
| node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE | | const int num_operations = graph->operations.size(); | ||||
| DEPSOP_FLAG_USER_MODIFIED); | TaskParallelSettings settings; | ||||
| BLI_parallel_range_settings_defaults(&settings); | |||||
| settings.min_iter_per_thread = 1024; | |||||
| BLI_task_parallel_range(0, num_operations, graph, graph_clear_operation_func, &settings); | |||||
| } | } | ||||
| /* Clear any entry tags which haven't been flushed. */ | /* Clear any entry tags which haven't been flushed. */ | ||||
| BLI_gset_clear(graph->entry_tags, NULL); | BLI_gset_clear(graph->entry_tags, NULL); | ||||
| Context not available. | |||||