diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 7283424abc..729a60b993 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -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, diff --git a/Source/Core/VideoCommon/TMEM.cpp b/Source/Core/VideoCommon/TMEM.cpp index b0cf61b8f2..66410438eb 100644 --- a/Source/Core/VideoCommon/TMEM.cpp +++ b/Source/Core/VideoCommon/TMEM.cpp @@ -4,6 +4,8 @@ #include +#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 diff --git a/Source/Core/VideoCommon/TMEM.h b/Source/Core/VideoCommon/TMEM.h index 26f7d12f0a..786e98d04c 100644 --- a/Source/Core/VideoCommon/TMEM.h +++ b/Source/Core/VideoCommon/TMEM.h @@ -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 diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 66c638cd02..03d46b7ff6 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -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(); diff --git a/Source/Core/VideoCommon/VideoState.cpp b/Source/Core/VideoCommon/VideoState.cpp index f954ca7c30..dc5ed9336e 100644 --- a/Source/Core/VideoCommon/VideoState.cpp +++ b/Source/Core/VideoCommon/VideoState.cpp @@ -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");