sh4: end the current timeslice on Stop()#2381
Merged
Merged
Conversation
Owner
|
This is much better. A few comments:
|
When Stop() is requested, also clear the SH4 cycle counter so the current timeslice ends as soon as possible. This prevents execution from continuing past a requested stop point.
Contributor
Author
|
You are totally right, that's an even simpler fix :). I tested that simpler fix based on your comment, and the extra CpuRunning check in rec-x64 is not needed. Just clearing cycle_counter in Stop() is enough to fix the affected cases on my side. I've simplified the PR to only change Stop(), and I’ve retargeted it to dev :) |
Owner
|
Nice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR supersedes #2309 with a cheaper implementation of the same fix.
The previous PR fixed the issue by making rec-x64 observe
CpuRunningbetween translated blocks, but that added work in the hottest part of the x64 dynarec.This version takes a lower-cost approach instead:
Stop()now also ends the current SH4 timeslice immediatelyUpdateSystem_INTC()ifCpuRunningis already falseIn practice, this keeps the same useful behavior in the affected cases: execution stops before the following render starts, which restores the expected delayed frame swap behavior in single-threaded Win64 GL/DX11 and also fixes the PenPen loading screen cut.
So compared to #2309, the main benefit is that this avoids a per-block
CpuRunningcheck in the hottest rec-x64 path while preserving the fix.Fixes #1615
Fixes #2308