texturecachebase resource manager changes

This commit is contained in:
iwubcode 2025-08-03 16:56:03 -05:00
commit 2e0fe7ed04

View file

@ -38,7 +38,6 @@
#include "VideoCommon/AbstractFramebuffer.h" #include "VideoCommon/AbstractFramebuffer.h"
#include "VideoCommon/AbstractGfx.h" #include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h" #include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/Assets/CustomResourceManager.h"
#include "VideoCommon/Assets/CustomTextureData.h" #include "VideoCommon/Assets/CustomTextureData.h"
#include "VideoCommon/Assets/TextureAssetUtils.h" #include "VideoCommon/Assets/TextureAssetUtils.h"
#include "VideoCommon/BPMemory.h" #include "VideoCommon/BPMemory.h"
@ -48,6 +47,7 @@
#include "VideoCommon/OpcodeDecoding.h" #include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/Present.h" #include "VideoCommon/Present.h"
#include "VideoCommon/Resources/CustomResourceManager.h"
#include "VideoCommon/ShaderCache.h" #include "VideoCommon/ShaderCache.h"
#include "VideoCommon/Statistics.h" #include "VideoCommon/Statistics.h"
#include "VideoCommon/TMEM.h" #include "VideoCommon/TMEM.h"
@ -291,9 +291,9 @@ bool TextureCacheBase::DidLinkedAssetsChange(const TCacheEntry& entry)
if (!entry.hires_texture) if (!entry.hires_texture)
return false; return false;
const auto [texture_data, load_time] = entry.hires_texture->LoadTexture(); const auto* resource = entry.hires_texture->LoadTexture();
return load_time > entry.last_load_time; return resource->GetLoadTime() > entry.last_load_time;
} }
RcTcacheEntry TextureCacheBase::ApplyPaletteToEntry(RcTcacheEntry& entry, const u8* palette, RcTcacheEntry TextureCacheBase::ApplyPaletteToEntry(RcTcacheEntry& entry, const u8* palette,
@ -1599,7 +1599,9 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
if (hires_texture) if (hires_texture)
{ {
has_arbitrary_mipmaps = hires_texture->HasArbitraryMipmaps(); has_arbitrary_mipmaps = hires_texture->HasArbitraryMipmaps();
std::tie(custom_texture_data, load_time) = hires_texture->LoadTexture(); const auto resource = hires_texture->LoadTexture();
load_time = resource->GetLoadTime();
custom_texture_data = resource->GetData();
if (custom_texture_data && !VideoCommon::ValidateTextureData( if (custom_texture_data && !VideoCommon::ValidateTextureData(
hires_texture->GetId(), *custom_texture_data, hires_texture->GetId(), *custom_texture_data,
texture_info.GetRawWidth(), texture_info.GetRawHeight())) texture_info.GetRawWidth(), texture_info.GetRawHeight()))
@ -1617,7 +1619,6 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
has_arbitrary_mipmaps, skip_texture_dump); has_arbitrary_mipmaps, skip_texture_dump);
entry->hires_texture = std::move(hires_texture); entry->hires_texture = std::move(hires_texture);
entry->last_load_time = load_time; entry->last_load_time = load_time;
entry->texture_info_name = std::move(texture_name);
if (g_ActiveConfig.bGraphicMods) if (g_ActiveConfig.bGraphicMods)
{ {
entry->texture_info_name = texture_info.CalculateTextureName().GetFullName(); entry->texture_info_name = texture_info.CalculateTextureName().GetFullName();