[Bf-blender-cvs] [1e61b759c7a] master: Fix T94797: crash when playing animation in eevee rendered view

Jacques Lucke noreply at git.blender.org
Wed Jan 12 11:15:36 CET 2022


Commit: 1e61b759c7adc10be2df7edab35c507e804a7fed
Author: Jacques Lucke
Date:   Wed Jan 12 11:15:22 2022 +0100
Branches: master
https://developer.blender.org/rB1e61b759c7adc10be2df7edab35c507e804a7fed

Fix T94797: crash when playing animation in eevee rendered view

The issue was caused by rBd09b1d2759861aa012ab2e7e4ce2ffa2.
Since this commit, the image users in gpu materials were updated
during depsgraph evaluation as well. However, there was a race
condition when one thread is deleting gpu materials in `BKE_material_eval`
while another thread is updating the image users at the same time.

The solution is to make sure that deleting gpu materials is done before
iterating over all gpu materials, by adding a new depsgraph relation.

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 1c09417e9ab..fcdc3fe58e8 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1475,6 +1475,17 @@ void DepsgraphRelationBuilder::build_animation_images(ID *id)
         id, NodeType::IMAGE_ANIMATION, OperationCode::IMAGE_ANIMATION);
     TimeSourceKey time_src_key;
     add_relation(time_src_key, image_animation_key, "TimeSrc -> Image Animation");
+
+    /* The image users of these ids may change during evaluation. Make sure that the image
+     * animation update happens after evaluation. */
+    if (GS(id->name) == ID_MA) {
+      OperationKey material_update_key(id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE);
+      add_relation(material_update_key, image_animation_key, "Material Update -> Image Animation");
+    }
+    else if (GS(id->name) == ID_WO) {
+      OperationKey world_update_key(id, NodeType::SHADING, OperationCode::WORLD_UPDATE);
+      add_relation(world_update_key, image_animation_key, "World Update -> Image Animation");
+    }
   }
 }



More information about the Bf-blender-cvs mailing list