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>2018-01-08 13:35:48 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-01-09 18:09:33 +0300
commit4c4a7e84c64472e38811933646f3fefeb071b0b4 (patch)
tree5145108f3689d4a24e6ed66137165896eeba43f6 /source/blender/depsgraph
parentd2708b0f73d5f0e0a40b36da21c6a0d15405e739 (diff)
Task scheduler: Use single parallel range function with more flexible function
Now all the fine-tuning is happening using parallel range settings structure, which avoid passing long lists of arguments, allows extend fine-tuning further, avoid having lots of various functions which basically does the same thing.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.cc7
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc38
2 files changed, 32 insertions, 13 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 4c5d68fb7ef..565bb041cb6 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -143,15 +143,18 @@ static void calculate_pending_func(void *data_v,
static void calculate_pending_parents(Depsgraph *graph, unsigned int layers)
{
const int num_operations = graph->operations.size();
- const bool do_threads = num_operations > 256;
+ const bool do_threads = (num_operations > 256);
CalculatePengindData data;
data.graph = graph;
data.layers = layers;
+ ParallelRangeSettings settings;
+ BLI_parallel_range_settings_defaults(&settings);
+ settings.use_threading = do_threads;
BLI_task_parallel_range(0,
num_operations,
&data,
calculate_pending_func,
- do_threads);
+ &settings);
}
static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 546d4e3cf5d..7650e907c0b 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -106,16 +106,26 @@ void flush_init_id_node_func(void *data_v,
BLI_INLINE void flush_prepare(Depsgraph *graph)
{
- const int num_operations = graph->operations.size();
- BLI_task_parallel_range(0, num_operations,
- graph,
- flush_init_operation_node_func,
- (num_operations > 256));
- const int num_id_nodes = graph->id_nodes.size();
- BLI_task_parallel_range(0, num_id_nodes,
- graph,
- flush_init_id_node_func,
- (num_id_nodes > 256));
+ {
+ const int num_operations = graph->operations.size();
+ ParallelRangeSettings settings;
+ BLI_parallel_range_settings_defaults(&settings);
+ settings.use_threading = (num_operations > 256);
+ BLI_task_parallel_range(0, num_operations,
+ graph,
+ flush_init_operation_node_func,
+ &settings);
+ }
+ {
+ const int num_id_nodes = graph->id_nodes.size();
+ ParallelRangeSettings settings;
+ BLI_parallel_range_settings_defaults(&settings);
+ settings.use_threading = (num_id_nodes > 256);
+ BLI_task_parallel_range(0, num_id_nodes,
+ graph,
+ flush_init_id_node_func,
+ &settings);
+ }
}
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
@@ -299,7 +309,13 @@ void deg_graph_clear_tags(Depsgraph *graph)
/* Go over all operation nodes, clearing tags. */
const int num_operations = graph->operations.size();
const bool do_threads = num_operations > 256;
- BLI_task_parallel_range(0, num_operations, graph, graph_clear_func, do_threads);
+ ParallelRangeSettings settings;
+ BLI_parallel_range_settings_defaults(&settings);
+ settings.use_threading = do_threads;
+ BLI_task_parallel_range(0, num_operations,
+ graph,
+ graph_clear_func,
+ &settings);
/* Clear any entry tags which haven't been flushed. */
BLI_gset_clear(graph->entry_tags, NULL);
}