Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-05-18 17:42:49 +0300
committerJacques Lucke <jacques@blender.org>2022-05-18 17:42:49 +0300
commitf517b3a29568fd43b722973c7c46d3c358ba0dda (patch)
treec166fc983bb0a717fcf3e49f6f2bd604dc8998a3 /source/blender/depsgraph/intern/builder/deg_builder_relations.cc
parent136a06285f0e953f65dc432a4dba1ff3d1f781ee (diff)
Fix T98157: improve animation fps with better check in depsgraph
Previously, the depsgraph assumed that every node tree might contain a reference to a video. This resulted noticeable overhead when there was no video. Checking whether a node tree contained a video was relatively expensive to do in the depsgraph. It is cheaper now due to the structure of the new node tree updater. This also adds an additional run-time field to `bNodeTree` (there are quite a few already). We should move those to a separate run-time struct, but not as part of a bug fix. Differential Revision: https://developer.blender.org/D14957
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 5eccb5a4eb2..3eeab23823c 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1446,10 +1446,15 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
void DepsgraphRelationBuilder::build_animation_images(ID *id)
{
/* See #DepsgraphNodeBuilder::build_animation_images. */
- const bool can_have_gpu_material = ELEM(GS(id->name), ID_MA, ID_WO);
+ bool has_image_animation = false;
+ if (ELEM(GS(id->name), ID_MA, ID_WO)) {
+ bNodeTree *ntree = *BKE_ntree_ptr_from_id(id);
+ if (ntree != nullptr && ntree->runtime_flag & NTREE_RUNTIME_FLAG_HAS_IMAGE_ANIMATION) {
+ has_image_animation = true;
+ }
+ }
- /* TODO: can we check for existence of node for performance? */
- if (can_have_gpu_material || BKE_image_user_id_has_animation(id)) {
+ if (has_image_animation || BKE_image_user_id_has_animation(id)) {
OperationKey image_animation_key(
id, NodeType::IMAGE_ANIMATION, OperationCode::IMAGE_ANIMATION);
TimeSourceKey time_src_key;