Skip to content
Permalink
Browse files

TextureCache: Support saving cache entries, including EFB copies

  • Loading branch information...
stenzek committed Jun 29, 2019
1 parent b26bb06 commit 1082468133342586ae2a5986408d163ce5aa14ca
@@ -72,7 +72,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;

// Don't forget to increase this after doing changes on the savestate system
static const u32 STATE_VERSION = 110; // Last changed in PR 8036
static const u32 STATE_VERSION = 111; // Last changed in PR 6321

// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,
@@ -11,6 +11,7 @@
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoState.h"

AsyncRequests AsyncRequests::s_singleton;

@@ -156,7 +157,7 @@ void AsyncRequests::HandleEvent(const AsyncRequests::Event& e)
break;

case Event::DO_SAVE_STATE:
g_video_backend->DoStateGPUThread(*e.do_save_state.p);
VideoCommon_DoState(*e.do_save_state.p);
break;
}
}
@@ -25,6 +25,7 @@
#include <imgui.h>

#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<u64>::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<VideoCommon::AsyncShaderCompiler> Renderer::CreateAsyncShaderCompiler()
{
return std::make_unique<VideoCommon::AsyncShaderCompiler>();
@@ -41,6 +41,7 @@ class AbstractTexture;
class AbstractStagingTexture;
class NativeVertexFormat;
class NetPlayChatUI;
class PointerWrap;
struct TextureConfig;
struct ComputePipelineConfig;
struct AbstractPipelineConfig;
@@ -237,6 +238,7 @@ class Renderer
void ChangeSurface(void* new_surface_handle);
void ResizeSurface();
bool UseVertexDepthRange() const;
void DoState(PointerWrap& p);

virtual std::unique_ptr<VideoCommon::AsyncShaderCompiler> CreateAsyncShaderCompiler();

@@ -356,9 +358,10 @@ class Renderer

// Tracking of XFB textures so we don't render duplicate frames.
u64 m_last_xfb_id = std::numeric_limits<u64>::max();

// Note: Only used for auto-ir
u64 m_last_xfb_ticks = 0;
u32 m_last_xfb_addr = 0;
u32 m_last_xfb_width = 0;
u32 m_last_xfb_stride = 0;
u32 m_last_xfb_height = 0;

// NOTE: The methods below are called on the framedumping thread.

0 comments on commit 1082468

Please sign in to comment.
You can’t perform that action at this time.