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-11-08 16:37:31 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-11-08 17:07:31 +0300
commit2a1e8287114de1c1907d9ef458342c433449c3fa (patch)
tree86a0b5e13363f6bd98950c99fbdc78939fc92cad /source/blender/depsgraph/intern/depsgraph_query.cc
parent19c14f0c8ac6236eedff2a1c5f3581b4fca79bf1 (diff)
Depsgraph: Use iterator over flat array for depsgraph_query
This way iteration order is much more predictable. This also solves issue with randomly failing Cycles regression tests.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_query.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 4431df80b69..864db49f601 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -256,23 +256,29 @@ static void deg_objects_iterator_step(BLI_Iterator *iter, DEG::IDDepsNode *id_no
void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data)
{
- Depsgraph *graph = data->graph;
+ Depsgraph *depsgraph = data->graph;
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ const size_t num_id_nodes = deg_graph->id_nodes.size();
- iter->data = data;
+ if (num_id_nodes == 0) {
+ iter->valid = false;
+ return;
+ }
+ /* TODO(sergey): What evaluation type we want here? */
DEG_evaluation_context_init(&data->eval_ctx, DAG_EVAL_RENDER);
- data->eval_ctx.scene_layer = DEG_get_evaluated_scene_layer(graph);
+ data->eval_ctx.scene_layer = DEG_get_evaluated_scene_layer(depsgraph);
+ iter->data = data;
data->dupli_parent = NULL;
data->dupli_list = NULL;
data->dupli_object_next = NULL;
data->dupli_object_current = NULL;
- data->scene = DEG_get_evaluated_scene(graph);
-
- DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
- BLI_ghashIterator_init(&data->gh_iter, deg_graph->id_hash);
+ data->scene = DEG_get_evaluated_scene(depsgraph);
+ data->id_node_index = 0;
+ data->num_id_nodes = num_id_nodes;
- DEG::IDDepsNode *id_node = (DEG::IDDepsNode *) BLI_ghashIterator_getValue(&data->gh_iter);
+ DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_objects_iterator_step(iter, id_node);
if (iter->skip) {
@@ -283,6 +289,8 @@ void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data
void DEG_objects_iterator_next(BLI_Iterator *iter)
{
DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
+ Depsgraph *depsgraph = data->graph;
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
do {
if (data->dupli_list) {
if (deg_objects_dupli_iterator_next(iter)) {
@@ -297,14 +305,13 @@ void DEG_objects_iterator_next(BLI_Iterator *iter)
}
}
- BLI_ghashIterator_step(&data->gh_iter);
- if (BLI_ghashIterator_done(&data->gh_iter)) {
+ ++data->id_node_index;
+ if (data->id_node_index == data->num_id_nodes) {
iter->valid = false;
return;
}
- DEG::IDDepsNode *id_node = (DEG::IDDepsNode *) BLI_ghashIterator_getValue(&data->gh_iter);
-
+ DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_objects_iterator_step(iter, id_node);
} while (iter->skip);
}