From cd61a140fa5da9b4bf32eb269c8a542108b94da2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 12 Dec 2023 20:21:20 +0100 Subject: [PATCH] Depsgraph: avoid unnecessary image updates, for compositor caching For non-COW datablocks like images, there is no need to update when they just got added to the depsgraph and there is no flag indicating a specific change that was made to them. Avoiding this helps preserve the cached image draw data used by the compositor. Co-authored-by: Sergey Sharybin Ref #115511 --- source/blender/depsgraph/intern/depsgraph_tag.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 4bf3878ac6b..96786164baf 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -557,7 +557,14 @@ void graph_tag_ids_for_visible_update(Depsgraph *graph) if (id_type == ID_OB) { flags |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY; } - graph_id_tag_update(bmain, graph, id_node->id_orig, flags, DEG_UPDATE_SOURCE_VISIBILITY); + /* For non-COW datablocks like images, there is no need to update when + * they just got added to the depsgraph and there is no flag indicating + * a specific change that was made to them. Unlike COW datablocks which + * have just been copied. + * This helps preserve cached image draw data for the compositor. */ + if (ID_TYPE_IS_COW(id_type) || flags != 0) { + graph_id_tag_update(bmain, graph, id_node->id_orig, flags, DEG_UPDATE_SOURCE_VISIBILITY); + } if (id_type == ID_SCE) { /* Make sure collection properties are up to date. */ id_node->tag_update(graph, DEG_UPDATE_SOURCE_VISIBILITY);