mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
VideoCommon: Expose the widescreen heuristic's standard and widescreen ratio values in onion config.
This commit is contained in:
parent
76a00551d1
commit
7cc4304918
@ -25,10 +25,12 @@ const Info<AspectMode> GFX_SUGGESTED_ASPECT_RATIO{{System::GFX, "Settings", "Sug
|
|||||||
AspectMode::Auto};
|
AspectMode::Auto};
|
||||||
const Info<u32> GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD{
|
const Info<u32> GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD{
|
||||||
{System::GFX, "Settings", "WidescreenHeuristicTransitionThreshold"}, 3};
|
{System::GFX, "Settings", "WidescreenHeuristicTransitionThreshold"}, 3};
|
||||||
const Info<float> GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_IDEAL{
|
|
||||||
{System::GFX, "Settings", "WidescreenHeuristicAspectRatioIdeal"}, (16 / 9.f) / (4 / 3.f)};
|
|
||||||
const Info<float> GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_SLOP{
|
const Info<float> GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_SLOP{
|
||||||
{System::GFX, "Settings", "WidescreenHeuristicAspectRatioSlop"}, 0.11f};
|
{System::GFX, "Settings", "WidescreenHeuristicAspectRatioSlop"}, 0.11f};
|
||||||
|
const Info<float> GFX_WIDESCREEN_HEURISTIC_STANDARD_RATIO{
|
||||||
|
{System::GFX, "Settings", "WidescreenHeuristicStandardRatio"}, 1.f};
|
||||||
|
const Info<float> GFX_WIDESCREEN_HEURISTIC_WIDESCREEN_RATIO{
|
||||||
|
{System::GFX, "Settings", "WidescreenHeuristicWidescreenRatio"}, (16 / 9.f) / (4 / 3.f)};
|
||||||
const Info<bool> GFX_CROP{{System::GFX, "Settings", "Crop"}, false};
|
const Info<bool> GFX_CROP{{System::GFX, "Settings", "Crop"}, false};
|
||||||
const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES{
|
const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES{
|
||||||
{System::GFX, "Settings", "SafeTextureCacheColorSamples"}, 128};
|
{System::GFX, "Settings", "SafeTextureCacheColorSamples"}, 128};
|
||||||
|
@ -30,8 +30,9 @@ extern const Info<bool> GFX_WIDESCREEN_HACK;
|
|||||||
extern const Info<AspectMode> GFX_ASPECT_RATIO;
|
extern const Info<AspectMode> GFX_ASPECT_RATIO;
|
||||||
extern const Info<AspectMode> GFX_SUGGESTED_ASPECT_RATIO;
|
extern const Info<AspectMode> GFX_SUGGESTED_ASPECT_RATIO;
|
||||||
extern const Info<u32> GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD;
|
extern const Info<u32> GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD;
|
||||||
extern const Info<float> GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_IDEAL;
|
|
||||||
extern const Info<float> GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_SLOP;
|
extern const Info<float> GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_SLOP;
|
||||||
|
extern const Info<float> GFX_WIDESCREEN_HEURISTIC_STANDARD_RATIO;
|
||||||
|
extern const Info<float> GFX_WIDESCREEN_HEURISTIC_WIDESCREEN_RATIO;
|
||||||
extern const Info<bool> GFX_CROP;
|
extern const Info<bool> GFX_CROP;
|
||||||
extern const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES;
|
extern const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES;
|
||||||
extern const Info<bool> GFX_SHOW_FPS;
|
extern const Info<bool> GFX_SHOW_FPS;
|
||||||
|
@ -77,25 +77,33 @@ constexpr Common::EnumMap<PrimitiveType, Primitive::GX_DRAW_POINTS> primitive_fr
|
|||||||
// Just in case any game decides to take this into account, we do both these
|
// Just in case any game decides to take this into account, we do both these
|
||||||
// tests with a large amount of slop.
|
// tests with a large amount of slop.
|
||||||
|
|
||||||
static bool IsAnamorphicProjection(const Projection::Raw& projection, const Viewport& viewport,
|
static float CalculateProjectionViewportRatio(const Projection::Raw& projection,
|
||||||
const float ideal_ratio, const float slop)
|
const Viewport& viewport)
|
||||||
{
|
{
|
||||||
// If ratio between our projection and viewport aspect ratios is similar to 16:9 / 4:3
|
|
||||||
// (the "ideal ratio"), we have an anamorphic projection. This value can be overridden
|
|
||||||
// by a GameINI.
|
|
||||||
|
|
||||||
const float projection_ar = projection[2] / projection[0];
|
const float projection_ar = projection[2] / projection[0];
|
||||||
const float viewport_ar = viewport.wd / viewport.ht;
|
const float viewport_ar = viewport.wd / viewport.ht;
|
||||||
|
|
||||||
return std::abs(std::abs(projection_ar / viewport_ar) - ideal_ratio) < ideal_ratio * slop;
|
return std::abs(projection_ar / viewport_ar);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsAnamorphicProjection(const Projection::Raw& projection, const Viewport& viewport,
|
||||||
|
const VideoConfig& config)
|
||||||
|
{
|
||||||
|
// If ratio between our projection and viewport aspect ratios is similar to 16:9 / 4:3
|
||||||
|
// we have an anamorphic projection. This value can be overridden
|
||||||
|
// by a GameINI.
|
||||||
|
|
||||||
|
return std::abs(CalculateProjectionViewportRatio(projection, viewport) -
|
||||||
|
config.widescreen_heuristic_widescreen_ratio) <
|
||||||
|
config.widescreen_heuristic_aspect_ratio_slop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsNormalProjection(const Projection::Raw& projection, const Viewport& viewport,
|
static bool IsNormalProjection(const Projection::Raw& projection, const Viewport& viewport,
|
||||||
const float slop)
|
const VideoConfig& config)
|
||||||
{
|
{
|
||||||
const float projection_ar = projection[2] / projection[0];
|
return std::abs(CalculateProjectionViewportRatio(projection, viewport) -
|
||||||
const float viewport_ar = viewport.wd / viewport.ht;
|
config.widescreen_heuristic_standard_ratio) <
|
||||||
return std::abs(std::abs(projection_ar / viewport_ar) - 1) < slop;
|
config.widescreen_heuristic_aspect_ratio_slop;
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexManagerBase::VertexManagerBase()
|
VertexManagerBase::VertexManagerBase()
|
||||||
@ -507,15 +515,15 @@ void VertexManagerBase::Flush()
|
|||||||
auto& counts =
|
auto& counts =
|
||||||
is_perspective ? m_flush_statistics.perspective : m_flush_statistics.orthographic;
|
is_perspective ? m_flush_statistics.perspective : m_flush_statistics.orthographic;
|
||||||
|
|
||||||
const float ideal_ratio = g_ActiveConfig.widescreen_heuristic_aspect_ratio_ideal;
|
// TODO: Potentially the viewport size could be used as weight for the flush count average.
|
||||||
const float slop = g_ActiveConfig.widescreen_heuristic_aspect_ratio_slop;
|
// This way a small minimap would have less effect than a fullscreen projection.
|
||||||
|
|
||||||
if (IsAnamorphicProjection(xfmem.projection.rawProjection, xfmem.viewport, ideal_ratio, slop))
|
if (IsAnamorphicProjection(xfmem.projection.rawProjection, xfmem.viewport, g_ActiveConfig))
|
||||||
{
|
{
|
||||||
++counts.anamorphic_flush_count;
|
++counts.anamorphic_flush_count;
|
||||||
counts.anamorphic_vertex_count += m_index_generator.GetIndexLen();
|
counts.anamorphic_vertex_count += m_index_generator.GetIndexLen();
|
||||||
}
|
}
|
||||||
else if (IsNormalProjection(xfmem.projection.rawProjection, xfmem.viewport, slop))
|
else if (IsNormalProjection(xfmem.projection.rawProjection, xfmem.viewport, g_ActiveConfig))
|
||||||
{
|
{
|
||||||
++counts.normal_flush_count;
|
++counts.normal_flush_count;
|
||||||
counts.normal_vertex_count += m_index_generator.GetIndexLen();
|
counts.normal_vertex_count += m_index_generator.GetIndexLen();
|
||||||
|
@ -88,10 +88,12 @@ void VideoConfig::Refresh()
|
|||||||
suggested_aspect_mode = Config::Get(Config::GFX_SUGGESTED_ASPECT_RATIO);
|
suggested_aspect_mode = Config::Get(Config::GFX_SUGGESTED_ASPECT_RATIO);
|
||||||
widescreen_heuristic_transition_threshold =
|
widescreen_heuristic_transition_threshold =
|
||||||
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD);
|
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_TRANSITION_THRESHOLD);
|
||||||
widescreen_heuristic_aspect_ratio_ideal =
|
|
||||||
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_IDEAL);
|
|
||||||
widescreen_heuristic_aspect_ratio_slop =
|
widescreen_heuristic_aspect_ratio_slop =
|
||||||
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_SLOP);
|
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_ASPECT_RATIO_SLOP);
|
||||||
|
widescreen_heuristic_standard_ratio =
|
||||||
|
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_STANDARD_RATIO);
|
||||||
|
widescreen_heuristic_widescreen_ratio =
|
||||||
|
Config::Get(Config::GFX_WIDESCREEN_HEURISTIC_WIDESCREEN_RATIO);
|
||||||
bCrop = Config::Get(Config::GFX_CROP);
|
bCrop = Config::Get(Config::GFX_CROP);
|
||||||
iSafeTextureCache_ColorSamples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
|
iSafeTextureCache_ColorSamples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
|
||||||
bShowFPS = Config::Get(Config::GFX_SHOW_FPS);
|
bShowFPS = Config::Get(Config::GFX_SHOW_FPS);
|
||||||
|
@ -107,8 +107,9 @@ struct VideoConfig final
|
|||||||
AspectMode aspect_mode{};
|
AspectMode aspect_mode{};
|
||||||
AspectMode suggested_aspect_mode{};
|
AspectMode suggested_aspect_mode{};
|
||||||
u32 widescreen_heuristic_transition_threshold = 0;
|
u32 widescreen_heuristic_transition_threshold = 0;
|
||||||
float widescreen_heuristic_aspect_ratio_ideal = 0.f;
|
|
||||||
float widescreen_heuristic_aspect_ratio_slop = 0.f;
|
float widescreen_heuristic_aspect_ratio_slop = 0.f;
|
||||||
|
float widescreen_heuristic_standard_ratio = 0.f;
|
||||||
|
float widescreen_heuristic_widescreen_ratio = 0.f;
|
||||||
bool bCrop = false; // Aspect ratio controls.
|
bool bCrop = false; // Aspect ratio controls.
|
||||||
bool bShaderCache = false;
|
bool bShaderCache = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user