From ca8d6748d6409943d758b59bf255a161061a648e Mon Sep 17 00:00:00 2001 From: iwubcode Date: Tue, 21 Mar 2023 19:54:50 -0500 Subject: VideoCommon: introduce linked assets in TCacheEntry, allowing for assets to be reloaded --- Source/Core/VideoCommon/TextureCacheBase.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 72151c9443..bcfa7898fd 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include #include @@ -35,7 +36,8 @@ struct VideoConfig; namespace VideoCommon { class CustomTextureData; -} +class GameTextureAsset; +} // namespace VideoCommon constexpr std::string_view EFB_DUMP_PREFIX = "efb1"; constexpr std::string_view XFB_DUMP_PREFIX = "xfb1"; @@ -113,6 +115,12 @@ struct fmt::formatter } }; +struct CachedTextureAsset +{ + std::shared_ptr m_asset; + std::optional m_last_write_time; +}; + struct TCacheEntry { // common members @@ -164,6 +172,8 @@ struct TCacheEntry std::string texture_info_name = ""; + CachedTextureAsset linked_asset; + explicit TCacheEntry(std::unique_ptr tex, std::unique_ptr fb); @@ -337,6 +347,10 @@ private: using TexPool = std::unordered_multimap; + static bool DidLinkedAssetsChange(const TCacheEntry& entry); + + TCacheEntry* LoadImpl(const TextureInfo& texture_info, bool force_reload); + bool CreateUtilityTextures(); void SetBackupConfig(const VideoConfig& config); -- cgit v1.2.3