[Bf-blender-cvs] [5a1b733a67e] master: Fix unnecessary modifier visibility re-evaluation

Sergey Sharybin noreply at git.blender.org
Wed Aug 31 15:11:29 CEST 2022


Commit: 5a1b733a67e35c4a6d043197b3a88fa178225869
Author: Sergey Sharybin
Date:   Tue Aug 30 16:25:27 2022 +0200
Branches: master
https://developer.blender.org/rB5a1b733a67e35c4a6d043197b3a88fa178225869

Fix unnecessary modifier visibility re-evaluation

While it is hard to measure the performance impact accurately, there
is no need to perform per-modifier string lookup on every frame update.

Implemented as an exceptional case in the code which flushes updates to
the entire component. Sounds a bit suboptimal, but there are already
other exception cases handled in the function.

Differential Revision: https://developer.blender.org/D15812

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

M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

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

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 1c313d42d8e..09981eb32c5 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -129,7 +129,18 @@ inline void flush_handle_component_node(IDNode *id_node,
    *
    * TODO(sergey): Make this a more generic solution. */
   if (!ELEM(comp_node->type, NodeType::PARTICLE_SETTINGS, NodeType::PARTICLE_SYSTEM)) {
+    const bool is_geometry_component = comp_node->type == NodeType::GEOMETRY;
     for (OperationNode *op : comp_node->operations) {
+      /* Special case for the visibility operation in the geometry component.
+       *
+       * This operation is a part of the geometry component so that manual tag for geometry recalc
+       * ensures that the visibility is re-evaluated. This operation is not to be re-evaluated when
+       * an update is flushed to the geometry component via a time dependency or a driver targeting
+       * a modifier. Skipping update in this case avoids CPU time unnecessarily spent looping over
+       * modifiers and looking up operations by name in the visibility evaluation function. */
+      if (is_geometry_component && op->opcode == OperationCode::VISIBILITY) {
+        continue;
+      }
       op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
     }
   }



More information about the Bf-blender-cvs mailing list