Renderer still needs to track swaps for savestates

This commit is contained in:
Scott Mansell 2023-01-31 00:59:17 +13:00
parent 3ae78b8e76
commit 3be63221c7
4 changed files with 14 additions and 10 deletions

View File

@ -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:

View File

@ -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
{

View File

@ -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)

View File

@ -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; }