summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2023-01-31 00:59:17 +1300
committerScott Mansell <phiren@gmail.com>2023-01-31 19:41:24 +1300
commit3be63221c7a1003ce6177e823da5ec399cd51015 (patch)
tree67a1401165ca60fae43df825ddb9eea3c8bc3159 /Source/Core/VideoCommon
parent3ae78b8e762787a3114baeabec2dd0178562ed1c (diff)
Renderer still needs to track swaps for savestates
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/AsyncRequests.cpp2
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp5
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp13
-rw-r--r--Source/Core/VideoCommon/RenderBase.h4
4 files changed, 14 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/AsyncRequests.cpp b/Source/Core/VideoCommon/AsyncRequests.cpp
index 8c254d4e71..7cbb134f7e 100644
--- a/Source/Core/VideoCommon/AsyncRequests.cpp
+++ b/Source/Core/VideoCommon/AsyncRequests.cpp
@@ -158,6 +158,8 @@ void AsyncRequests::HandleEvent(const AsyncRequests::Event& e)
case Event::SWAP_EVENT:
g_presenter->ViSwap(e.swap_event.xfbAddr, e.swap_event.fbWidth, e.swap_event.fbStride,
e.swap_event.fbHeight, e.time);
+ g_renderer->TrackSwaps(e.swap_event.xfbAddr, e.swap_event.fbWidth, e.swap_event.fbStride,
+ e.swap_event.fbHeight, e.time);
break;
case Event::BBOX_READ:
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index 865d73dbed..1985ac6527 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -350,8 +350,9 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
if (g_ActiveConfig.bImmediateXFB)
{
// below div two to convert from bytes to pixels - it expects width, not stride
- g_presenter->ImmediateSwap(destAddr, destStride / 2, destStride, height,
- Core::System::GetInstance().GetCoreTiming().GetTicks());
+ u64 ticks = Core::System::GetInstance().GetCoreTiming().GetTicks();
+ g_presenter->ImmediateSwap(destAddr, destStride / 2, destStride, height, ticks);
+ g_renderer->TrackSwaps(destAddr, destStride / 2, destStride, height, ticks);
}
else
{
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 0e8bb41393..e252921c9f 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -365,7 +365,7 @@ void Renderer::OnConfigChanged(u32 bits)
UpdateWidescreen();
}
-void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks)
+void Renderer::TrackSwaps(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks)
{
if (xfb_addr && fb_width && fb_stride && fb_height)
{
@@ -412,13 +412,14 @@ void Renderer::DoState(PointerWrap& p)
if (p.IsReadMode())
{
- // Force the next xfb to be displayed.
- g_presenter->ClearLastXfbId();
-
m_was_orthographically_anamorphic = false;
- // And actually display it.
- Swap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride, m_last_xfb_height, m_last_xfb_ticks);
+ // This technically counts as the end of the frame
+ AfterFrameEvent::Trigger();
+
+ // re-display the most recent XFB
+ g_presenter->ImmediateSwap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride,
+ m_last_xfb_height, m_last_xfb_ticks);
}
#if defined(HAVE_FFMPEG)
diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h
index 520acdb8e4..cceddea638 100644
--- a/Source/Core/VideoCommon/RenderBase.h
+++ b/Source/Core/VideoCommon/RenderBase.h
@@ -91,8 +91,8 @@ public:
virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points);
- // Finish up the current frame, print some stats
- void Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);
+ // Track swaps for save-states
+ void TrackSwaps(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);
bool IsGameWidescreen() const { return m_is_game_widescreen; }