summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexManagerBase.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2023-09-06 18:44:43 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2023-09-06 18:45:28 -0500
commit7cc4304918609ff3a09e996ad03c1742dda5ca51 (patch)
tree74e3c2a9080e63f3fcd859ef803be4408f1964fe /Source/Core/VideoCommon/VertexManagerBase.cpp
parent76a00551d10a61622f67b6574a7c6f515369ee6c (diff)
VideoCommon: Expose the widescreen heuristic's standard and widescreen ratio values in onion config.
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexManagerBase.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp
index e1d294f331..2aac0f6f90 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.cpp
+++ b/Source/Core/VideoCommon/VertexManagerBase.cpp
@@ -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
// tests with a large amount of slop.
+static float CalculateProjectionViewportRatio(const Projection::Raw& projection,
+ const Viewport& viewport)
+{
+ const float projection_ar = projection[2] / projection[0];
+ const float viewport_ar = viewport.wd / viewport.ht;
+
+ return std::abs(projection_ar / viewport_ar);
+}
+
static bool IsAnamorphicProjection(const Projection::Raw& projection, const Viewport& viewport,
- const float ideal_ratio, const float slop)
+ const VideoConfig& config)
{
// 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
+ // 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 * slop;
+ 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,
- const float slop)
+ const VideoConfig& config)
{
- 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) < slop;
+ return std::abs(CalculateProjectionViewportRatio(projection, viewport) -
+ config.widescreen_heuristic_standard_ratio) <
+ config.widescreen_heuristic_aspect_ratio_slop;
}
VertexManagerBase::VertexManagerBase()
@@ -507,15 +515,15 @@ void VertexManagerBase::Flush()
auto& counts =
is_perspective ? m_flush_statistics.perspective : m_flush_statistics.orthographic;
- const float ideal_ratio = g_ActiveConfig.widescreen_heuristic_aspect_ratio_ideal;
- const float slop = g_ActiveConfig.widescreen_heuristic_aspect_ratio_slop;
+ // TODO: Potentially the viewport size could be used as weight for the flush count average.
+ // 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_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_vertex_count += m_index_generator.GetIndexLen();