diff options
| author | Stenzek <stenzek@gmail.com> | 2019-07-24 05:19:13 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2019-07-24 05:19:22 +1000 |
| commit | 53e30c06e85f5c5bd3270aaee0e1d13a51f59446 (patch) | |
| tree | bdc4fed5a93d26c647d6397941ac34b54c5fd595 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | 63358adfb144f9a935a819358bc73e3769eaea8c (diff) | |
Config: Add an option to skip saving texture cache to save state
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 974b121c56..2f330bb2bc 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -24,6 +24,7 @@ #include "Common/MemoryUtil.h" #include "Common/StringUtil.h" +#include "Core/Config/GraphicsSettings.h" #include "Core/ConfigManager.h" #include "Core/FifoPlayer/FifoPlayer.h" #include "Core/FifoPlayer/FifoRecorder.h" @@ -469,7 +470,7 @@ std::optional<TextureCacheBase::TexPoolEntry> TextureCacheBase::DeserializeTextu std::vector<u8> texture_data; p.Do(texture_data); - if (p.GetMode() != PointerWrap::MODE_READ) + if (p.GetMode() != PointerWrap::MODE_READ || texture_data.empty()) return std::nullopt; auto tex = AllocateTexture(config); @@ -546,20 +547,23 @@ void TextureCacheBase::DoSaveState(PointerWrap& p) // of address/hash to entry ID. std::vector<std::pair<u32, u32>> textures_by_address_list; std::vector<std::pair<u64, u32>> textures_by_hash_list; - for (const auto& it : textures_by_address) + if (Config::Get(Config::GFX_SAVE_TEXTURE_CACHE_TO_STATE)) { - if (ShouldSaveEntry(it.second)) + for (const auto& it : textures_by_address) { - u32 id = AddCacheEntryToMap(it.second); - textures_by_address_list.push_back(std::make_pair(it.first, id)); + if (ShouldSaveEntry(it.second)) + { + u32 id = AddCacheEntryToMap(it.second); + textures_by_address_list.push_back(std::make_pair(it.first, id)); + } } - } - for (const auto& it : textures_by_hash) - { - if (ShouldSaveEntry(it.second)) + for (const auto& it : textures_by_hash) { - u32 id = AddCacheEntryToMap(it.second); - textures_by_hash_list.push_back(std::make_pair(it.first, id)); + if (ShouldSaveEntry(it.second)) + { + u32 id = AddCacheEntryToMap(it.second); + textures_by_hash_list.push_back(std::make_pair(it.first, id)); + } } } |
