[Bf-blender-cvs] [ae1f8315f77] master: Depsgraph: minor optimization in order of checks

Campbell Barton noreply at git.blender.org
Thu Mar 31 04:07:56 CEST 2022


Commit: ae1f8315f77b34c9e658697e4d7083355c216f60
Author: Campbell Barton
Date:   Thu Mar 31 13:02:33 2022 +1100
Branches: master
https://developer.blender.org/rBae1f8315f77b34c9e658697e4d7083355c216f60

Depsgraph: minor optimization in order of checks

Checking BKE_image_user_id_has_animation loops over ID users
which never needs to run for material & world data-blocks.

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

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

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 76bfd216c03..4782f1c4a5d 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1085,7 +1085,7 @@ void DepsgraphNodeBuilder::build_animation_images(ID *id)
    * tree. */
   const bool can_have_gpu_material = ELEM(GS(id->name), ID_MA, ID_WO);
 
-  if (BKE_image_user_id_has_animation(id) || can_have_gpu_material) {
+  if (can_have_gpu_material || BKE_image_user_id_has_animation(id)) {
     ID *id_cow = get_cow_id(id);
     add_operation_node(
         id,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 04fb14515dc..487f096031e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1423,7 +1423,7 @@ void DepsgraphRelationBuilder::build_animation_images(ID *id)
   const bool can_have_gpu_material = ELEM(GS(id->name), ID_MA, ID_WO);
 
   /* TODO: can we check for existence of node for performance? */
-  if (BKE_image_user_id_has_animation(id) || can_have_gpu_material) {
+  if (can_have_gpu_material || BKE_image_user_id_has_animation(id)) {
     OperationKey image_animation_key(
         id, NodeType::IMAGE_ANIMATION, OperationCode::IMAGE_ANIMATION);
     TimeSourceKey time_src_key;



More information about the Bf-blender-cvs mailing list