Skip to content

Commit eeff56c

Browse files
authored
Merge pull request #12602 from hrydgard/frame-duplication
Add option to improve frame pacing through duplicate frames if below 60hz.
2 parents ccd62e7 + d385096 commit eeff56c

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

Core/Config.cpp

+1
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

+1
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

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

UI/GameSettingsScreen.cpp

+5
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)