TMEM: Handle savestate and init

This commit is contained in:
Scott Mansell 2021-10-10 15:49:59 +13:00
parent 88bd10cd30
commit a33cf27885
5 changed files with 27 additions and 4 deletions

View File

@ -73,7 +73,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
constexpr u32 STATE_VERSION = 138; // Last changed in PR 9670
constexpr u32 STATE_VERSION = 139; // Last changed in PR 8350
// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,

View File

@ -4,6 +4,8 @@
#include <array>
#include "Common/ChunkFile.h"
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/TMEM.h"
@ -32,9 +34,9 @@ struct TextureUnitState
bool Overlaps(const BankConfig& other) const;
};
BankConfig even;
BankConfig odd;
State state;
BankConfig even = {};
BankConfig odd = {};
State state = State::INVALID;
bool Overlaps(const TextureUnitState& other) const;
};
@ -221,4 +223,14 @@ bool IsValid(u32 unit)
return s_unit[unit].state != TextureUnitState::State::INVALID;
}
void Init()
{
s_unit.fill({});
}
void DoState(PointerWrap& p)
{
p.DoArray(s_unit);
}
} // namespace TMEM

View File

@ -18,4 +18,8 @@ void Bind(u32 unit, int num_blocks_width, int num_blocks_height, bool is_mipmapp
void FinalizeBinds(BitSet32 used_textures);
bool IsCached(u32 unit);
bool IsValid(u32 unit);
void Init();
void DoState(PointerWrap& p);
} // namespace TMEM

View File

@ -47,6 +47,7 @@
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/TMEM.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VertexManagerBase.h"
@ -322,6 +323,7 @@ void VideoBackendBase::InitializeShared()
VertexShaderManager::Init();
GeometryShaderManager::Init();
PixelShaderManager::Init();
TMEM::Init();
g_Config.VerifyValidity();
UpdateActiveConfig();

View File

@ -13,6 +13,7 @@
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/TMEM.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/TextureDecoder.h"
#include "VideoCommon/VertexManagerBase.h"
@ -46,6 +47,10 @@ void VideoCommon_DoState(PointerWrap& p)
p.DoArray(texMem);
p.DoMarker("texMem");
// TMEM
TMEM::DoState(p);
p.DoMarker("TMEM");
// FIFO
Fifo::DoState(p);
p.DoMarker("Fifo");