-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allocate unique track_blends
vector for animation states
#51448
Allocate unique track_blends
vector for animation states
#51448
Conversation
Needs a rebase to solve merge conflicts (and that should remove the unwanted merge commit too). |
Animation resources are meant to be reused by different players, so they should not contain state data. Eventually also, the idea is to process different players in different threads, so my plan was to create a global state pointer using TLS or something. |
Hang on, let me squash the commits... |
3fe3331
to
68ca133
Compare
Okay, squashed back into a single commit. I can backport this to 3.x too if you want. I like the notion of threading the AnimationTree, never really thought much about it, but it makes a lot of sense. |
What I meant mostly is that you should not store permanent data in these resources. |
I agree, this I'm basically treating this as a quick and dirty fix to this specific bug caused by overwritten track_blends. I realise it doesn't fully solve the underlying problem, especially if the plan is fully thread the tree. |
Is this "quick and dirty fix" from over a year ago still relevant? :) |
I conclude that this PR is still valid/necessary for fixing #51408 bug. So, I want to merge this IMO. However, since @reduz is considering multi-threading the animation blend calculation, we need to know if this will be a problem. As far as I see it, this fix does not hold parameters in animation resource permanently, but rather avoids using references around during the blend calculation, so I guess this PR remove this concern.
|
68ca133
to
be10200
Compare
@TokageItLab Okay, rebased now! |
7747e80
to
9f1a8d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug in #51408 still exists and this PR will fix it.
Considering the possibility of AnimationNode reuse, this blend values should not be reused and should be rewritten each time the blend calculation. Since there is currently no better solution, I recommends that this fix be applied.
track_blends
vector for animation states
@SaracenOne Could you use this PR's title as your commit message title, and put the rest into the commit message body? |
9f1a8d5
to
6d38e16
Compare
Quick fix for a bug which occurs when blending the result of multiple instanced state machines outputting the same animation, but using filter tracks.
6d38e16
to
18c792f
Compare
Okay, updated now! |
Thanks! |
This is a fix for the bug logged here (#51408). The only downside is that the fix introduces an extra memory allocation since it know longer uses the pointers to AnimationNode blends directly in order to prevent memory being overwritten on instanced animation state machines. There are ways this could be cached, so requesting feedback for profiling and alternative suggestions on how to fix.
Bugsquad edit: Fixes #51408.