Skip to content

Commit ad3c670

Browse files
committed
Add option to improve frame pacing through duplicate frames if framerate is below 60hz.
Should help #9736, and fixes #12325.
1 parent 62420e3 commit ad3c670

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

Core/Config.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ static ConfigSetting graphicsSettings[] = {
776776
ConfigSetting("LogFrameDrops", &g_Config.bLogFrameDrops, false, true, false),
777777

778778
ConfigSetting("InflightFrames", &g_Config.iInflightFrames, 3, true, false),
779+
ConfigSetting("RenderDuplicateFrames", &g_Config.bRenderDuplicateFrames, false, true, true),
779780

780781
ConfigSetting(false),
781782
};

Core/Config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct Config {
207207
bool bGfxDebugOutput;
208208
bool bGfxDebugSplitSubmit;
209209
int iInflightFrames;
210+
bool bRenderDuplicateFrames;
210211

211212
// Sound
212213
bool bEnableSound;

Core/HLE/sceDisplay.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,11 @@ void __DisplayFlip(int cyclesLate) {
753753
// Also let's always flip for animated shaders.
754754
const ShaderInfo *shaderInfo = g_Config.sPostShaderName == "Off" ? nullptr : GetPostShaderInfo(g_Config.sPostShaderName);
755755
bool postEffectRequiresFlip = false;
756+
// postEffectRequiresFlip is not compatible with frameskip unthrottling, see #12325.
756757
if (shaderInfo && g_Config.iRenderingMode != FB_NON_BUFFERED_MODE)
757-
postEffectRequiresFlip = shaderInfo->requires60fps;
758+
postEffectRequiresFlip = (shaderInfo->requires60fps || g_Config.bRenderDuplicateFrames) && !(g_Config.bFrameSkipUnthrottle && !FrameTimingThrottled());
758759
const bool fbDirty = gpu->FramebufferDirty();
760+
759761
if (fbDirty || noRecentFlip || postEffectRequiresFlip) {
760762
int frameSleepPos = frameTimeHistoryPos;
761763
CalculateFPS();

UI/GameSettingsScreen.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ void GameSettingsScreen::CreateViews() {
343343
return UI::EVENT_CONTINUE;
344344
});
345345
#endif
346+
CheckBox *frameDuplication = graphicsSettings->Add(new CheckBox(&g_Config.bRenderDuplicateFrames, gr->T("Render duplicate frames to 60hz")));
347+
frameDuplication->OnClick.Add([=](EventParams &e) {
348+
settingInfo_->Show(gr->T("RenderDuplicateFrames Tip", "Can make framerate smoother in games that run at lower framerates"), e.v);
349+
return UI::EVENT_CONTINUE;
350+
});
346351

347352
if (GetGPUBackend() == GPUBackend::VULKAN || GetGPUBackend() == GPUBackend::OPENGL) {
348353
static const char *bufferOptions[] = { "No buffer", "Up to 1", "Up to 2" };

0 commit comments

Comments
 (0)