Fix really wacky edge case when switching to Auto FrameSkip from "skip buffered" mode.

Fixes issue #20596
This commit is contained in:
Henrik Rydgård committed 2025-07-08 20:08:23 +02:00
1 parent 2cebaa7509
commit a80756574c
4 files changed
+15 -4

No files matched your search

-3
View File
@@ -1460,9 +1460,6 @@ void Config::PostLoadCleanup(bool gameSpecific) {
if (g_Config.sCustomDriver == "Default") {
g_Config.sCustomDriver = "";
}
// Convert old volume settings.
}
void Config::PreSaveCleanup(bool gameSpecific) {
+9 -1
View File
@@ -425,7 +425,7 @@ static void DoFrameTiming(bool throttle, bool *skipFrame, float scaledTimestep,
// Auto-frameskip automatically if speed limit is set differently than the default.
int frameSkipNum = DisplayCalculateFrameSkip();
if (g_Config.bAutoFrameSkip) {
if (g_Config.bAutoFrameSkip && !g_Config.bSkipBufferEffects) {
// autoframeskip
// Argh, we are falling behind! Let's skip a frame and see if we catch up.
if (curFrameTime > nextFrameTime && doFrameSkip) {
@@ -694,6 +694,14 @@ void __DisplayFlip(int cyclesLate) {
} else {
gstate_c.skipDrawReason &= ~SKIPDRAW_SKIPFRAME;
numSkippedFrames = 0;
// NOTE!! It can happen that if we just toggled frameskip (especially auto), we are still in a state
// where we don't have a framebuffer bound, from the last frame. But framebuffermanager still might think
// that we're in non-buffered mode.
if (gpu->GetFramebufferManagerCommon() && !gpu->GetFramebufferManagerCommon()->UseBufferedRendering() && !g_Config.bSkipBufferEffects) {
gpu->GetFramebufferManagerCommon()->ForceUseBufferedRendering(!g_Config.bSkipBufferEffects);
gstate_c.skipDrawReason &= ~SKIPDRAW_NON_DISPLAYED_FB;
}
}
// Returning here with coreState == CORE_NEXTFRAME causes a buffer flip to happen (next frame).
+2
View File
@@ -1707,6 +1707,8 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) {
} else if (useBufferedRendering_) {
WARN_LOG(Log::FrameBuf, "Using buffered rendering, and current VFB lacks an FBO: %08x", vfb->fb_address);
} else {
// This is OK because here we're in "skip buffered" mode, so even if we haven't presented
// we will have a render target.
presentation_->NotifyPresent();
}
+4
View File
@@ -385,6 +385,10 @@ public:
return useBufferedRendering_;
}
void ForceUseBufferedRendering(bool buf) {
useBufferedRendering_ = true;
}
// TODO: Maybe just include the last depth buffer address in this, too.
bool MayIntersectFramebufferColor(u32 start) const {
// Clear the cache/kernel bits.