Fix #108778: Crash when rendering multiple view layers
The rendering pipeline will re-use dependency graph and request for re-building its relations for every new view layer, and try to re-use as much evaluation as possible. This could potentially run into situation when a content of collection is changed: due to the difference in the per-view layer visibility. If the evaluated collection has an object cache this will make the cache to get out-of-sync with the actual content. The cache on the evaluated collection might be created when instancing system iterates over the collection. This change makes it so the cache is freed when the dependency graph relations are updated. This might be a bit too intrusive. There might be ways to somehow ensure the content of the collection is still the same as it was before the relations update, but this is much more complicated task. Perhaps the performance is already good enough. This is a collaboration with Jacques Lucke, who was looking into the same report, bouncing some ideas back and forth, and helped testing the patch. Pull Request: https://projects.blender.org/blender/blender/pulls/108816
This commit is contained in:
committed by
Jacques Lucke
parent
e40f993a70
commit
954c262a96
@@ -20,6 +20,7 @@
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_collection.h"
|
||||
|
||||
#include "RNA_prototypes.h"
|
||||
|
||||
@@ -182,6 +183,14 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
|
||||
flag |= ID_RECALC_NTREE_OUTPUT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Collection content might have changed (children collection might have been added or
|
||||
* removed from the graph based on their inclusion and visibility flags). */
|
||||
const ID_Type id_type = GS(id_node->id_cow->name);
|
||||
if (id_type == ID_GR) {
|
||||
BKE_collection_object_cache_free(reinterpret_cast<Collection *>(id_node->id_cow));
|
||||
}
|
||||
}
|
||||
/* Restore recalc flags from original ID, which could possibly contain recalc flags set by
|
||||
* an operator and then were carried on by the undo system. */
|
||||
flag |= id_orig->recalc;
|
||||
|
||||
Reference in New Issue
Block a user