summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2025-10-29 01:21:30 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2025-11-23 11:04:24 -0600
commit2d21a9920577b8c827d056d9a5e03dcf026ae6e1 (patch)
treea8c67c7951019e9897778d0b518b379584ba3a70 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent59d9c1772a0b27ea38fff28ac6c15bba824227be (diff)
VideoCommon: separate the concept of a 'resource' from an 'asset'. A resource is potentially multiple assets that are chained together but represent one type of data to the rest of the system. An example is a 'material'. A 'material' is a collection of textures, a custom shader, and some metadata that all comes together to form what the concept of the material is. There will be a 'material' resource. For now, start small by introducing the interface and change our texture loading which used assets from the old resource manager, to an actual resource.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index ce27429381..6ae8b4f96f 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -4,6 +4,7 @@
#include "VideoCommon/TextureCacheBase.h"
#include <algorithm>
+#include <chrono>
#include <cmath>
#include <cstring>
#include <memory>
@@ -37,7 +38,6 @@
#include "VideoCommon/AbstractFramebuffer.h"
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/AbstractStagingTexture.h"
-#include "VideoCommon/Assets/CustomResourceManager.h"
#include "VideoCommon/Assets/CustomTextureData.h"
#include "VideoCommon/Assets/TextureAssetUtils.h"
#include "VideoCommon/BPMemory.h"
@@ -48,6 +48,7 @@
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/Present.h"
+#include "VideoCommon/Resources/CustomResourceManager.h"
#include "VideoCommon/ShaderCache.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/TMEM.h"
@@ -266,9 +267,9 @@ bool TextureCacheBase::DidLinkedAssetsChange(const TCacheEntry& entry)
if (!entry.hires_texture)
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,
@@ -1569,7 +1570,9 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
if (hires_texture)
{
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(
hires_texture->GetId(), *custom_texture_data,
texture_info.GetRawWidth(), texture_info.GetRawHeight()))