From 93c28ee3076b033bf10132a60d85e64623e33040 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 3 Oct 2026 22:27:39 -0500 Subject: VideoCommon: return a RcTcacheEntry (shared_ptr) from TextureCacheBase::Load() This allows the texture entry to be stored off or passed around and shared in the future --- Source/Core/VideoCommon/TextureCacheBase.cpp | 10 +++++----- 1 file changed, 5 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 4e4567da8e..e91479799b 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1239,7 +1239,7 @@ private: std::vector levels; }; -TCacheEntry* TextureCacheBase::Load(u32 stage) +RcTcacheEntry TextureCacheBase::Load(u32 stage) { if (auto entry = LoadImpl(stage, false)) { @@ -1248,19 +1248,19 @@ TCacheEntry* TextureCacheBase::Load(u32 stage) return entry; } - InvalidateTexture(GetTexCacheIter(entry)); + InvalidateTexture(GetTexCacheIter(entry.get())); return LoadImpl(stage, true); } return nullptr; } -TCacheEntry* TextureCacheBase::LoadImpl(u32 stage, bool force_reload) +RcTcacheEntry TextureCacheBase::LoadImpl(u32 stage, bool force_reload) { // if this stage was not invalidated by changes to texture registers, keep the current texture if (!force_reload && TMEM::IsValid(stage) && m_bound_textures[stage]) { - TCacheEntry* entry = m_bound_textures[stage].get(); + const auto& entry = m_bound_textures[stage]; // If the TMEM configuration is such that this texture is more or less guaranteed to still // be in TMEM, then we know we can reuse the old entry without even hashing the memory // @@ -1308,7 +1308,7 @@ TCacheEntry* TextureCacheBase::LoadImpl(u32 stage, bool force_reload) TMEM::Bind(texture_info.GetStage(), entry->NumBlocksX(), entry->NumBlocksY(), entry->GetNumLevels() > 1, entry->format == TextureFormat::RGBA8); - return entry.get(); + return entry; } RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSampleSize, -- cgit v1.2.3