From 1082468133342586ae2a5986408d163ce5aa14ca Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 29 Jun 2019 19:27:53 +1000 Subject: TextureCache: Support saving cache entries, including EFB copies --- Source/Core/VideoCommon/RenderBase.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/RenderBase.cpp') diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 40b6f9d51e..48b8e4cfd3 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -25,6 +25,7 @@ #include #include "Common/Assert.h" +#include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Common/Config/Config.h" #include "Common/Event.h" @@ -1324,8 +1325,11 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6 } // Update our last xfb values - m_last_xfb_width = (fb_width < 1 || fb_width > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fb_width; - m_last_xfb_height = (fb_height < 1 || fb_height > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fb_height; + m_last_xfb_addr = xfb_addr; + m_last_xfb_ticks = ticks; + m_last_xfb_width = fb_width; + m_last_xfb_stride = fb_stride; + m_last_xfb_height = fb_height; } else { @@ -1681,6 +1685,27 @@ bool Renderer::UseVertexDepthRange() const return fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f; } +void Renderer::DoState(PointerWrap& p) +{ + p.Do(m_aspect_wide); + p.Do(m_frame_count); + p.Do(m_prev_efb_format); + p.Do(m_last_xfb_ticks); + p.Do(m_last_xfb_addr); + p.Do(m_last_xfb_width); + p.Do(m_last_xfb_stride); + p.Do(m_last_xfb_height); + + if (p.GetMode() == PointerWrap::MODE_READ) + { + // Force the next xfb to be displayed. + m_last_xfb_id = std::numeric_limits::max(); + + // 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); + } +} + std::unique_ptr Renderer::CreateAsyncShaderCompiler() { return std::make_unique(); -- cgit v1.2.3