From f1f1ecc9d116c8295b76d636774f5e922e8941ae Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 20 Mar 2023 01:23:51 -0500 Subject: Core / VideoCommon: update HiresTexture to use CustomAssetLoader --- Source/Core/VideoCommon/TextureCacheBase.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 5b0bde53ca..90d2c2048f 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1582,7 +1582,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp InvalidateTexture(oldest_entry); } - VideoCommon::CustomTextureData* data = nullptr; + std::shared_ptr data = nullptr; bool has_arbitrary_mipmaps = false; std::shared_ptr hires_texture; if (g_ActiveConfig.bHiresTextures) @@ -1590,19 +1590,27 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp hires_texture = HiresTexture::Search(texture_info); if (hires_texture) { - data = &hires_texture->GetData(); + data = hires_texture->GetAsset()->GetData(); has_arbitrary_mipmaps = hires_texture->HasArbitraryMipmaps(); + if (data) + { + if (!hires_texture->GetAsset()->Validate(texture_info.GetRawWidth(), + texture_info.GetRawHeight())) + { + data = nullptr; + } + } } } return CreateTextureEntry( TextureCreationInfo{base_hash, full_hash, bytes_per_block, palette_size}, texture_info, - textureCacheSafetyColorSampleSize, data, has_arbitrary_mipmaps); + textureCacheSafetyColorSampleSize, data.get(), has_arbitrary_mipmaps); } RcTcacheEntry TextureCacheBase::CreateTextureEntry( const TextureCreationInfo& creation_info, const TextureInfo& texture_info, - const int safety_color_sample_size, VideoCommon::CustomTextureData* custom_texture_data, + const int safety_color_sample_size, const VideoCommon::CustomTextureData* custom_texture_data, const bool custom_arbitrary_mipmaps) { #ifdef __APPLE__ @@ -1741,7 +1749,7 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry( if (g_ActiveConfig.bDumpTextures) { - const std::string basename = HiresTexture::GenBaseName(texture_info, true); + const std::string basename = texture_info.CalculateTextureName().GetFullName(); for (u32 level = 0; level < texLevels; ++level) { DumpTexture(entry, basename, level, entry->has_arbitrary_mips); -- cgit v1.2.3