diff options
| author | OatmealDome <julian@oatmealdome.me> | 2023-09-04 13:02:17 -0400 |
|---|---|---|
| committer | OatmealDome <julian@oatmealdome.me> | 2023-09-05 11:50:49 -0400 |
| commit | 4938b99600da9fc6e1241e6aad476286b74850a9 (patch) | |
| tree | 44dba6f2bffe93d0494fa1ed72d9b7d27203b7c8 /Source/Core/VideoCommon/VertexManagerBase.cpp | |
| parent | de781a6fa79f466f66b56f161e3e1a15289691b1 (diff) | |
VertexManagerBase: Allow widecreen heuristic constants to be overriden by onion config
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 564eb684dc..e1d294f331 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -76,26 +76,26 @@ constexpr Common::EnumMap<PrimitiveType, Primitive::GX_DRAW_POINTS> primitive_fr // by ~9% in opposite directions. // Just in case any game decides to take this into account, we do both these // tests with a large amount of slop. -static constexpr float ASPECT_RATIO_SLOP = 0.11f; -static bool IsAnamorphicProjection(const Projection::Raw& projection, const Viewport& viewport) +static bool IsAnamorphicProjection(const Projection::Raw& projection, const Viewport& viewport, + const float ideal_ratio, const float slop) { // If ratio between our projection and viewport aspect ratios is similar to 16:9 / 4:3 - // we have an anamorphic projection. - static constexpr float IDEAL_RATIO = (16 / 9.f) / (4 / 3.f); + // (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 viewport_ar = viewport.wd / viewport.ht; - return std::abs(std::abs(projection_ar / viewport_ar) - IDEAL_RATIO) < - IDEAL_RATIO * ASPECT_RATIO_SLOP; + return std::abs(std::abs(projection_ar / viewport_ar) - ideal_ratio) < ideal_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 float projection_ar = projection[2] / projection[0]; const float viewport_ar = viewport.wd / viewport.ht; - return std::abs(std::abs(projection_ar / viewport_ar) - 1) < ASPECT_RATIO_SLOP; + return std::abs(std::abs(projection_ar / viewport_ar) - 1) < slop; } VertexManagerBase::VertexManagerBase() @@ -507,12 +507,15 @@ void VertexManagerBase::Flush() auto& counts = is_perspective ? m_flush_statistics.perspective : m_flush_statistics.orthographic; - if (IsAnamorphicProjection(xfmem.projection.rawProjection, xfmem.viewport)) + const float ideal_ratio = g_ActiveConfig.widescreen_heuristic_aspect_ratio_ideal; + const float slop = g_ActiveConfig.widescreen_heuristic_aspect_ratio_slop; + + if (IsAnamorphicProjection(xfmem.projection.rawProjection, xfmem.viewport, ideal_ratio, slop)) { ++counts.anamorphic_flush_count; counts.anamorphic_vertex_count += m_index_generator.GetIndexLen(); } - else if (IsNormalProjection(xfmem.projection.rawProjection, xfmem.viewport)) + else if (IsNormalProjection(xfmem.projection.rawProjection, xfmem.viewport, slop)) { ++counts.normal_flush_count; counts.normal_vertex_count += m_index_generator.GetIndexLen(); |
