summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2020-01-14 10:57:35 +1000
committerStenzek <stenzek@gmail.com>2020-01-14 10:57:35 +1000
commit11ba623f267814885c2d69c0f1214c9c576eb916 (patch)
treeb457f666d71b77ab3eb41c3223fd52f955f9f0bb /Source/Core/VideoCommon/RenderBase.cpp
parentefc1ee8e6ab6b7727e9403376e554dd044814272 (diff)
Add an option to present/skip presenting duplicate frames
Currently, we do not display every second frame in 25fps/30fps games which run to vsync. This improves performance as there's less rendering for the GPU to perform, but when combined with vsync, could cause frame pacing issues. This commit adds an option to force every frame generated by the console to be displayed to the host, which may improve pacing for these games.
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index d94eac2c0d..71281defdf 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -1190,8 +1190,10 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6
MathUtil::Rectangle<int> xfb_rect;
const auto* xfb_entry =
g_texture_cache->GetXFBTexture(xfb_addr, fb_width, fb_height, fb_stride, &xfb_rect);
- if (xfb_entry && xfb_entry->id != m_last_xfb_id)
+ if (xfb_entry &&
+ (!g_ActiveConfig.bSkipPresentingDuplicateXFBs || xfb_entry->id != m_last_xfb_id))
{
+ const bool is_duplicate_frame = xfb_entry->id == m_last_xfb_id;
m_last_xfb_id = xfb_entry->id;
// Since we use the common pipelines here and draw vertices if a batch is currently being
@@ -1235,20 +1237,24 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6
SetWindowSize(xfb_rect.GetWidth(), xfb_rect.GetHeight());
}
- m_fps_counter.Update();
+ if (!is_duplicate_frame)
+ {
+ m_fps_counter.Update();
+
+ DolphinAnalytics::PerformanceSample perf_sample;
+ perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
+ perf_sample.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims;
+ perf_sample.num_draw_calls = g_stats.this_frame.num_draw_calls;
+ DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));
- DolphinAnalytics::PerformanceSample perf_sample;
- perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
- perf_sample.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims;
- perf_sample.num_draw_calls = g_stats.this_frame.num_draw_calls;
- DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));
+ if (IsFrameDumping())
+ DumpCurrentFrame(xfb_entry->texture.get(), xfb_rect, ticks);
- if (IsFrameDumping())
- DumpCurrentFrame(xfb_entry->texture.get(), xfb_rect, ticks);
+ // Begin new frame
+ m_frame_count++;
+ g_stats.ResetFrame();
+ }
- // Begin new frame
- m_frame_count++;
- g_stats.ResetFrame();
g_shader_cache->RetrieveAsyncShaders();
g_vertex_manager->OnEndFrame();
BeginImGuiFrame();
@@ -1263,16 +1269,18 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6
// rate and not waiting for vblank. Otherwise, we'd end up with a huge list of pending copies.
g_texture_cache->FlushEFBCopies();
- // Remove stale EFB/XFB copies.
- g_texture_cache->Cleanup(m_frame_count);
+ if (!is_duplicate_frame)
+ {
+ // Remove stale EFB/XFB copies.
+ g_texture_cache->Cleanup(m_frame_count);
+ Core::Callback_VideoCopiedToXFB(true);
+ }
// Handle any config changes, this gets propogated to the backend.
CheckForConfigChanges();
g_Config.iSaveTargetId = 0;
EndUtilityDrawing();
-
- Core::Callback_VideoCopiedToXFB(true);
}
else
{