RenderBase: Allow widescreen heuristic's transition threshold to be overridden by onion config

This commit is contained in:
OatmealDome 2023-01-09 00:25:11 -05:00
parent 6f6eb73667
commit de781a6fa7
5 changed files with 11 additions and 5 deletions

View File

@ -23,6 +23,8 @@ const Info<bool> GFX_WIDESCREEN_HACK{{System::GFX, "Settings", "wideScreenHack"}
const Info<AspectMode> GFX_ASPECT_RATIO{{System::GFX, "Settings", "AspectRatio"}, AspectMode::Auto};
const Info<AspectMode> GFX_SUGGESTED_ASPECT_RATIO{{System::GFX, "Settings", "SuggestedAspectRatio"},
AspectMode::Auto};
const Info<u32> GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD{
{System::GFX, "Settings", "WidescreenHeuristicTransitionThreshold"}, 3};
const Info<bool> GFX_CROP{{System::GFX, "Settings", "Crop"}, false};
const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES{
{System::GFX, "Settings", "SafeTextureCacheColorSamples"}, 128};

View File

@ -29,6 +29,7 @@ extern const Info<int> GFX_ADAPTER;
extern const Info<bool> GFX_WIDESCREEN_HACK;
extern const Info<AspectMode> GFX_ASPECT_RATIO;
extern const Info<AspectMode> GFX_SUGGESTED_ASPECT_RATIO;
extern const Info<u32> GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD;
extern const Info<bool> GFX_CROP;
extern const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES;
extern const Info<bool> GFX_SHOW_FPS;

View File

@ -86,6 +86,8 @@ void VideoConfig::Refresh()
bWidescreenHack = Config::Get(Config::GFX_WIDESCREEN_HACK);
aspect_mode = Config::Get(Config::GFX_ASPECT_RATIO);
suggested_aspect_mode = Config::Get(Config::GFX_SUGGESTED_ASPECT_RATIO);
widescreen_heuristic_transition_threshold =
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD);
bCrop = Config::Get(Config::GFX_CROP);
iSafeTextureCache_ColorSamples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
bShowFPS = Config::Get(Config::GFX_SHOW_FPS);

View File

@ -106,6 +106,7 @@ struct VideoConfig final
bool bWidescreenHack = false;
AspectMode aspect_mode{};
AspectMode suggested_aspect_mode{};
u32 widescreen_heuristic_transition_threshold = 0;
bool bCrop = false; // Aspect ratio controls.
bool bShaderCache = false;

View File

@ -70,13 +70,13 @@ void WidescreenManager::UpdateWidescreenHeuristic()
// Modify the threshold based on which aspect ratio we're already using:
// If the game's in 4:3, it probably won't switch to anamorphic, and vice-versa.
static constexpr u32 TRANSITION_THRESHOLD = 3;
const u32 transition_threshold = g_ActiveConfig.widescreen_heuristic_transition_threshold;
const auto looks_normal = [](auto& counts) {
return counts.normal_vertex_count > counts.anamorphic_vertex_count * TRANSITION_THRESHOLD;
const auto looks_normal = [transition_threshold](auto& counts) {
return counts.normal_vertex_count > counts.anamorphic_vertex_count * transition_threshold;
};
const auto looks_anamorphic = [](auto& counts) {
return counts.anamorphic_vertex_count > counts.normal_vertex_count * TRANSITION_THRESHOLD;
const auto looks_anamorphic = [transition_threshold](auto& counts) {
return counts.anamorphic_vertex_count > counts.normal_vertex_count * transition_threshold;
};
const auto& persp = flush_statistics.perspective;