From fe86f257b5d3d5633bf6af247e20ab25a5dbe313 Mon Sep 17 00:00:00 2001 From: iota97 Date: Tue, 15 Sep 2020 07:45:57 +0200 Subject: [PATCH] Cache 60 FPS requirement --- Core/Config.cpp | 1 + Core/Config.h | 1 + Core/HLE/sceDisplay.cpp | 2 +- UI/GameSettingsScreen.cpp | 3 ++- Windows/MainWindowMenu.cpp | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index ace856117590..c5e36508f94b 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -806,6 +806,7 @@ static ConfigSetting graphicsSettings[] = { ReportedConfigSetting("SplineBezierQuality", &g_Config.iSplineBezierQuality, 2, true, true), ReportedConfigSetting("HardwareTessellation", &g_Config.bHardwareTessellation, false, true, true), ConfigSetting("TextureShader", &g_Config.sTextureShaderName, "Off", true, true), + ConfigSetting("ShaderChainRequires60FPS", &g_Config.bShaderChainRequires60FPS, false, true, true), ReportedConfigSetting("MemBlockTransferGPU", &g_Config.bBlockTransferGPU, true, true, true), ReportedConfigSetting("DisableSlowFramebufEffects", &g_Config.bDisableSlowFramebufEffects, false, true, true), diff --git a/Core/Config.h b/Core/Config.h index b999569edace..f34d87c6f3be 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -215,6 +215,7 @@ struct Config { std::vector vPostShaderNames; // Off for chain end (only Off for no shader) std::map mPostShaderSetting; + bool bShaderChainRequires60FPS; std::string sTextureShaderName; bool bGfxDebugOutput; bool bGfxDebugSplitSubmit; diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 7d0b9e7b6043..a421736d93ae 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -763,7 +763,7 @@ void __DisplayFlip(int cyclesLate) { // postEffectRequiresFlip is not compatible with frameskip unthrottling, see #12325. if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && !(unthrottleNeedsSkip && !FrameTimingThrottled())) { - postEffectRequiresFlip = duplicateFrames || PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames)); + postEffectRequiresFlip = duplicateFrames || g_Config.bShaderChainRequires60FPS; } const bool fbDirty = gpu->FramebufferDirty(); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 4fa553bc8b8e..ec82b7a29679 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -311,7 +311,7 @@ void GameSettingsScreen::CreateViews() { std::vector alreadyAddedShader; for (int i = 0; i < g_Config.vPostShaderNames.size() && i < ARRAY_SIZE(shaderNames_); ++i) { - // Vector pointer get invalidated on resize, cache name to have always a valid reference for drawing + // Vector element pointer get invalidated on resize, cache name to have always a valid reference in the rendering thread shaderNames_[i] = g_Config.vPostShaderNames[i]; postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&shaderNames_[i], StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1), &PostShaderTranslateName)); postProcChoice_->OnClick.Add([=](EventParams &e) { @@ -1257,6 +1257,7 @@ void GameSettingsScreen::update() { } if (g_ShaderNameListChanged) { g_ShaderNameListChanged = false; + g_Config.bShaderChainRequires60FPS = PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames)); RecreateViews(); } } diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 8e5b83aeecec..2f2ba2da5bf5 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -1070,6 +1070,7 @@ namespace MainWindow { g_Config.vPostShaderNames.push_back(availableShaders[index]); g_Config.vPostShaderNames.push_back("Off"); g_ShaderNameListChanged = true; + g_Config.bShaderChainRequires60FPS = PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames)); NativeMessageReceived("gpu_resized", ""); break; }