[Bf-blender-cvs] [ac20970bc20] master: Depsgraph: optimize out evaluation of hidden objects
Sergey Sharybin
noreply at git.blender.org
Wed Aug 31 15:11:29 CEST 2022
Commit: ac20970bc208aef6257b16e129f08dcbe892869d
Author: Sergey Sharybin
Date: Tue Aug 30 16:54:17 2022 +0200
Branches: master
https://developer.blender.org/rBac20970bc208aef6257b16e129f08dcbe892869d
Depsgraph: optimize out evaluation of hidden objects
This change makes it so that objects which are temporary hidden from
the viewport (the icon toggle in outliner) do not affect on the
performance of the viewport.
The attached file demonstrates the issue. Before this change hiding
the object does not change FPS, after this change FPS goes high when
the object is hidden.
F13435936
Changing the object temporary visibility is already expected to tag
scene for bases updates, which flushes down the stream to the object
visibility update. So the only remaining topic was to ensure the
graph does a special round of visibility update on such changes.
Differential Revision: https://developer.blender.org/D15813
===================================================================
M source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
===================================================================
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 09981eb32c5..30ee626f0f8 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -371,6 +371,10 @@ void deg_graph_flush_updates(Depsgraph *graph)
while (op_node != nullptr) {
/* Tag operation as required for update. */
op_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
+ /* Tag depsgraph visibility update when visibility operation is tagged for an update. */
+ if (op_node->opcode == OperationCode::VISIBILITY) {
+ graph->need_update_nodes_visibility = true;
+ }
/* Inform corresponding ID and component nodes about the change. */
ComponentNode *comp_node = op_node->owner;
IDNode *id_node = comp_node->owner;
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc b/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
index a056ba1dfa7..e35e992fc8b 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
@@ -34,10 +34,14 @@ void deg_evaluate_object_node_visibility(::Depsgraph *depsgraph, IDNode *id_node
DEG_debug_print_eval(depsgraph, __func__, object->id.name, &object->id);
- const int required_flags = (graph->mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT :
- BASE_ENABLED_RENDER;
-
- const bool is_enabled = object->base_flag & required_flags;
+ bool is_enabled;
+ if (graph->mode == DAG_EVAL_VIEWPORT) {
+ is_enabled = (object->base_flag & BASE_ENABLED_VIEWPORT) &&
+ ((object->base_flag & BASE_HIDDEN) == 0);
+ }
+ else {
+ is_enabled = (object->base_flag & BASE_ENABLED_RENDER);
+ };
if (id_node->is_enabled_on_eval != is_enabled) {
id_node->is_enabled_on_eval = is_enabled;
More information about the Bf-blender-cvs
mailing list