1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Fix all spinner ticks being alive and causing performance degradation

Regressed in https://github.com/ppy/osu/pull/25216.

The new logic will ensure at least one tick is ready for judgement.
There shouldn't be a case where more than one is needed in a single
frame.
This commit is contained in:
Dean Herbert 2023-11-01 18:28:05 +09:00
parent 57d8b5ddc9
commit c2de03aa44
No known key found for this signature in database
2 changed files with 15 additions and 6 deletions

View File

@ -275,6 +275,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
if (spinningSample != null && spinnerFrequencyModulate)
spinningSample.Frequency.Value = spinning_sample_modulated_base_frequency + Progress;
// Ticks can theoretically be judged at any point in the spinner's duration.
// For performance reasons, we only want to keep the next tick alive.
var next = NestedHitObjects.FirstOrDefault(h => !h.Judged);
// See default `LifetimeStart` as set in `DrawableSpinnerTick`.
if (next?.LifetimeStart == double.MaxValue)
{
// the tick can be theoretically judged at any point in the spinner's duration,
// so it must be alive throughout the spinner's entire lifetime.
// this mostly matters for correct sample playback.
next.LifetimeStart = HitObject.StartTime;
}
}
protected override void UpdateAfterChildren()

View File

@ -11,8 +11,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public override bool DisplayResult => false;
protected DrawableSpinner DrawableSpinner => (DrawableSpinner)ParentHitObject;
public DrawableSpinnerTick()
: this(null)
{
@ -29,10 +27,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
base.OnApply();
// the tick can be theoretically judged at any point in the spinner's duration,
// so it must be alive throughout the spinner's entire lifetime.
// this mostly matters for correct sample playback.
LifetimeStart = DrawableSpinner.HitObject.StartTime;
// Lifetime will be managed by `DrawableSpinner`.
LifetimeStart = double.MaxValue;
}
/// <summary>