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

Core: Skip duplicate frames when using frame advance #8730

Merged
merged 2 commits into from Apr 16, 2020

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Apr 7, 2020

https://bugs.dolphin-emu.org/issues/12025

It used to be the case that frame advance skipped duplicate frames (i.e. it would take 30 frame advances to get through one second of emulated time in a 30 fps game), but this broke in PR #8347. Skipping duplicate frames making TASing less annoying.

@phire
Copy link
Member

phire commented Apr 8, 2020

I'll point out that this isn't going to work so well in any XFB mode other than Immediate Present.

Not sure if that's an issue you care about.

@JosJuice
Copy link
Member Author

JosJuice commented Apr 8, 2020

My testing was done without Immediately Present XFB, and I didn't run into any problems. What type of issue would it be more specifically?

@phire
Copy link
Member

phire commented Apr 8, 2020

This PR makes an assumption that if the game copies something to a XFB, then that XFB will be displayed on screen in the next frame.

While this might be true in the general case, there are a lot of edge cases.

  1. A frame might finish rendering just before the start of the field. The interrupt handler takes a short while to fire so in a race condition the XFB might not be displayed until a full frame later.

  2. The game might be rendering partial XFBs. If it finishes one XFB section before the field boundary, it might still be waiting on a second section before it calls the XFB finished and displays it.

  3. The game might be locked to 30fps. Just because an XFB is ready this field, doesn't mean the game will display it this field. For pacing issues.

  4. The game might have more than 2 XFBs allocated. It might race ahead and finish 3 XFBs now and not display them until later.

@phire
Copy link
Member

phire commented Apr 8, 2020

Oh.. thought of some more edge cases.

Homebrew often draws directly to XFB. These updates will be skipped over.

Retail games occasionally do this too. Some games render loading screens or cutscenes directly to XFB.

@phire
Copy link
Member

phire commented Apr 8, 2020

So, we already have code that knows if an XFB is duplicate or not.

You should pipe that though to the FrameUpdate callback.

@JosJuice JosJuice changed the title Core: Skip duplicate frames when using frame advance [WIP] Core: Skip duplicate frames when using frame advance Apr 8, 2020
@JosJuice JosJuice force-pushed the frame-advance-duplicate-frame branch from 1884659 to 8623447 Compare April 8, 2020 12:49
@JosJuice
Copy link
Member Author

JosJuice commented Apr 8, 2020

I've pushed a new version that should be better, though I'm not sure if it solves every problem you mentioned.

@JosJuice JosJuice force-pushed the frame-advance-duplicate-frame branch from 8623447 to bb8aac1 Compare April 8, 2020 12:54
@JosJuice JosJuice changed the title [WIP] Core: Skip duplicate frames when using frame advance Core: Skip duplicate frames when using frame advance Apr 8, 2020
@JosJuice JosJuice force-pushed the frame-advance-duplicate-frame branch 3 times, most recently from f1a1c25 to bcbe8d5 Compare April 8, 2020 17:32
Source/Core/Core/Core.cpp Outdated Show resolved Hide resolved
Copy link
Member

@phire phire left a comment

Choose a reason for hiding this comment

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

Other than the minior naming/documentation issues I mentioned above, LGTM.

@JosJuice JosJuice force-pushed the frame-advance-duplicate-frame branch from bcbe8d5 to 311c558 Compare April 8, 2020 22:27
It used to be the case that frame advance skipped duplicate frames
(i.e. it would take 30 frame advances to get through one second
of emulated time in a 30 fps game), but this broke in 9c5c3c0.
Skipping duplicate frames making TASing less annoying.
@JosJuice JosJuice force-pushed the frame-advance-duplicate-frame branch from 311c558 to 812ad42 Compare April 9, 2020 09:39
@JMC47 JMC47 merged commit 935b12d into dolphin-emu:master Apr 16, 2020
@JosJuice JosJuice deleted the frame-advance-duplicate-frame branch April 17, 2020 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants