Skip to content
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

Fix WaveformGraph regenerating on position changes #5197

Merged
merged 8 commits into from
May 25, 2022

Conversation

peppy
Copy link
Member

@peppy peppy commented May 24, 2022

This is a bare minimum fix for waveforms being regenerated completely when their Position is changed.

There's plenty more work which needs to be done to improve performance during resampling / generation, but this alone allows me to move forward with my more intensive usage of this class for now.

result = true;
// We should regenerate when `Scale` changed, but not `Position`.
// Unfortunately both of these are grouped together in `MiscGeometry`.
if (requiredPointCount != resampledPointCount)
Copy link
Contributor

@smoogipoo smoogipoo May 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this (well, the Scale/DrawWidth referencing) is technically an invalid operation to be done in Invalidate(), because it could behave badly with relative/autosizing. Could this check be moved to the schedule instead, or is that prohibitively difficult to do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had things structured differently to avoid this then double-took for a reason I can't remember. Please check the new additions. Also please confirm AddOnce is correctly used here (seems to be, but I can never be 100%).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what was changed here, doesn't look like anything was? Missing a commit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I just re-refactored to the point it didn't solve the issue you pointed out. Will revisit.

@bdach
Copy link
Collaborator

bdach commented May 24, 2022

Test failures need attention here.

@smoogipoo
Copy link
Contributor

Applied two more fixes, the first is a race condition that I couldn't leave hanging (was present in the previous code too), the second prevented the waveform from being regenerated when there's a feedback loop causing multiple invalidations in successive frames.

@smoogipoo smoogipoo enabled auto-merge May 25, 2022 09:24
@smoogipoo smoogipoo merged commit 4f89ff9 into ppy:master May 25, 2022
@peppy peppy deleted the waveform-invalidation-performance branch July 4, 2022 05:08
peppy added a commit to peppy/osu-framework that referenced this pull request Sep 29, 2023
The previous attempt to fix this
(ppy#5197) helped, but there
were still some scenarios where invalidation would cause
regeneration.

Let's just do our own invalidation for now.

One thing I'm not sure about is whether checking `DrawSize` here is
enough (should I be using `ScreenSpaceDrawQuad.Size` instead?).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants