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 <mail@jlucke.com>2019-04-17 19:09:33 +0300
committerJacques Lucke <mail@jlucke.com>2019-04-17 19:09:33 +0300
commit81ce3801bf0a876b73b73817ca1a61b4e81b214d (patch)
treed9f749b8d494c68903b3f591434522c119177f7e /source/blender/blenkernel/intern/anim_sys.c
parent5f5a22970b4f7b3c42f73cf1f5a5dac4f32a14b0 (diff)
Animation: Refactor storage usage during fcurve modifier evaluation
Previously, when a fcurve modifier used storage, many heap allocations were done. This caused major slowdowns as described in T63656. Furthermore, the storage usage was a special case only used by the Cycles modifier. This refactor makes storage usage the "normal" case. That reduces the overall complexity. The storage is stack allocated now. The framerate on the provided test scene went up from ~5 fps to ~16 fps. Reviewers: angavrilov Differential Revision: https://developer.blender.org/D4701
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 75244a8ba8a..de92077b052 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -2965,7 +2965,6 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
NlaEvalStrip *nes,
NlaEvalSnapshot *snapshot)
{
- FModifierStackStorage *storage;
ListBase tmp_modifiers = {NULL, NULL};
NlaStrip *strip = nes->strip;
FCurve *fcu;
@@ -2986,8 +2985,12 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers);
/* evaluate strip's modifiers which modify time to evaluate the base curves at */
- storage = evaluate_fmodifiers_storage_new(&tmp_modifiers);
- evaltime = evaluate_time_fmodifiers(storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time);
+ FModifiersStackStorage storage;
+ storage.modifier_count = BLI_listbase_count(&tmp_modifiers);
+ storage.size_per_modifier = evaluate_fmodifiers_storage_size_per_modifier(&tmp_modifiers);
+ storage.buffer = alloca(storage.modifier_count * storage.size_per_modifier);
+
+ evaltime = evaluate_time_fmodifiers(&storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time);
NlaBlendData blend = {
.snapshot = snapshot,
@@ -3013,7 +3016,7 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
/* apply strip's F-Curve Modifiers on this value
* NOTE: we apply the strip's original evaluation time not the modified one (as per standard F-Curve eval)
*/
- evaluate_value_fmodifiers(storage, &tmp_modifiers, fcu, &value, strip->strip_time);
+ evaluate_value_fmodifiers(&storage, &tmp_modifiers, fcu, &value, strip->strip_time);
/* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s)
* stored in this channel if it has been used already
@@ -3025,9 +3028,6 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
nlaeval_blend_flush(&blend);
- /* free temporary storage */
- evaluate_fmodifiers_storage_free(storage);
-
/* unlink this strip's modifiers from the parent's modifiers again */
nlaeval_fmodifiers_split_stacks(&strip->modifiers, modifiers);
}