diff --git a/Core/Config.cpp b/Core/Config.cpp index 4f974fa194..55f2296e88 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -713,6 +713,7 @@ static const ConfigSetting graphicsSettings[] = { ConfigSetting("ReplaceTextures", &g_Config.bReplaceTextures, true, CfgFlag::PER_GAME | CfgFlag::REPORT), ConfigSetting("SaveNewTextures", &g_Config.bSaveNewTextures, false, CfgFlag::PER_GAME | CfgFlag::REPORT), ConfigSetting("IgnoreTextureFilenames", &g_Config.bIgnoreTextureFilenames, false, CfgFlag::PER_GAME), + ConfigSetting("ReplacementTextureLoadSpeed", &g_Config.iReplacementTextureLoadSpeed, 0, CfgFlag::PER_GAME), ConfigSetting("TexScalingLevel", &g_Config.iTexScalingLevel, 1, CfgFlag::PER_GAME | CfgFlag::REPORT), ConfigSetting("TexScalingType", &g_Config.iTexScalingType, 0, CfgFlag::PER_GAME | CfgFlag::REPORT), diff --git a/Core/Config.h b/Core/Config.h index 2c48c05c83..cf5079a6b4 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -230,6 +230,7 @@ public: int bHighQualityDepth; bool bReplaceTextures; bool bSaveNewTextures; + int iReplacementTextureLoadSpeed; bool bIgnoreTextureFilenames; int iTexScalingLevel; // 0 = auto, 1 = off, 2 = 2x, ..., 5 = 5x int iTexScalingType; // 0 = xBRZ, 1 = Hybrid diff --git a/Core/ConfigValues.h b/Core/ConfigValues.h index fe4e7efc5f..e218fb07fb 100644 --- a/Core/ConfigValues.h +++ b/Core/ConfigValues.h @@ -86,6 +86,13 @@ enum TextureFiltering { TEX_FILTER_AUTO_MAX_QUALITY = 4, }; +enum ReplacementTextureLoadSpeed { + SLOW = 0, + MEDIUM = 1, + FAST = 2, + INSTANT = 3, +}; + enum BufferFilter { SCALE_LINEAR = 1, SCALE_NEAREST = 2, diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 93a140fbfd..9dac04aebf 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -133,8 +133,25 @@ void TextureCacheCommon::StartFrame() { if (fps <= 5.0f) { fps = 60.0f; } + + float baseValue = 0.5f; + switch (g_Config.iReplacementTextureLoadSpeed) { + case (int)ReplacementTextureLoadSpeed::SLOW: + baseValue = 0.5f; + break; + case (int)ReplacementTextureLoadSpeed::MEDIUM: + baseValue = 0.75f; + break; + case (int)ReplacementTextureLoadSpeed::FAST: + baseValue = 1.0f; + break; + case (int)ReplacementTextureLoadSpeed::INSTANT: + baseValue = 100000.0f; // no budget limit, effectively. + break; + } + // Allow spending half a frame on uploading textures. - replacementFrameBudgetSeconds_ = 0.5f / fps; + replacementFrameBudgetSeconds_ = baseValue / fps; if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) { gpuStats.numReplacerTrackedTex = replacer_.GetNumTrackedTextures(); diff --git a/UI/DeveloperToolsScreen.cpp b/UI/DeveloperToolsScreen.cpp index 5ea2ad95b5..a1b2791911 100644 --- a/UI/DeveloperToolsScreen.cpp +++ b/UI/DeveloperToolsScreen.cpp @@ -112,6 +112,10 @@ void DeveloperToolsScreen::CreateTextureReplacementTab(UI::LinearLayout *list) { return UI::EVENT_DONE; }); } + + static const char *texLoadSpeeds[] = { "Slow (smooth)", "Medium", "Fast", "Instant (may stutter)" }; + PopupMultiChoice *texLoadSpeed = list->Add(new PopupMultiChoice(&g_Config.iReplacementTextureLoadSpeed, dev->T("Texture load speed"), texLoadSpeeds, 0, ARRAY_SIZE(texLoadSpeeds), I18NCat::DEVELOPER, screenManager())); + texLoadSpeed->SetChoiceIcon(3, ImageID("I_WARNING")); } void DeveloperToolsScreen::CreateGeneralTab(UI::LinearLayout *list) {