From bafe78203d4eb508c8b9e5d55923cde8d60b72ce Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sun, 4 May 2025 17:50:14 -0500 Subject: VideoCommon: remove 'GetLastAssetWriteTime' and switch to a steady_clock for asset times --- Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h') diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h index c4d99baf82..8c20fa4f42 100644 --- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h @@ -25,9 +25,6 @@ public: LoadInfo LoadMaterial(const AssetID& asset_id, MaterialData* data) override; LoadInfo LoadMesh(const AssetID& asset_id, MeshData* data) override; - // Gets the latest time from amongst all the files in the asset map - TimeType GetLastAssetWriteTime(const AssetID& asset_id) const override; - // Assigns the asset id to a map of files, how this map is read is dependent on the data // For instance, a raw texture would expect the map to have a single entry and load that // file as the asset. But a model file data might have its data spread across multiple files -- cgit v1.2.3 From 2ae43324cb23510bfaeb749dfa2bdc4c4c66c554 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Thu, 4 Jul 2024 17:41:49 -0500 Subject: VideoCommon: move AssetMap to a types header file, so it can be pulled in without the DirectFilesystemAssetLibrary dependencies, the header will be expanded later --- Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h') diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h index 8c20fa4f42..97f6118969 100644 --- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h @@ -10,6 +10,7 @@ #include "VideoCommon/Assets/CustomAssetLibrary.h" #include "VideoCommon/Assets/CustomTextureData.h" +#include "VideoCommon/Assets/Types.h" namespace VideoCommon { @@ -18,8 +19,6 @@ namespace VideoCommon class DirectFilesystemAssetLibrary final : public CustomAssetLibrary { public: - using AssetMap = std::map; - LoadInfo LoadTexture(const AssetID& asset_id, TextureData* data) override; LoadInfo LoadPixelShader(const AssetID& asset_id, PixelShaderData* data) override; LoadInfo LoadMaterial(const AssetID& asset_id, MaterialData* data) override; @@ -28,16 +27,16 @@ public: // Assigns the asset id to a map of files, how this map is read is dependent on the data // For instance, a raw texture would expect the map to have a single entry and load that // file as the asset. But a model file data might have its data spread across multiple files - void SetAssetIDMapData(const AssetID& asset_id, AssetMap asset_path_map); + void SetAssetIDMapData(const AssetID& asset_id, Assets::AssetMap asset_path_map); private: // Loads additional mip levels into the texture structure until _mip texture is not found bool LoadMips(const std::filesystem::path& asset_path, CustomTextureData::ArraySlice* data); // Gets the asset map given an asset id - AssetMap GetAssetMapForID(const AssetID& asset_id) const; + Assets::AssetMap GetAssetMapForID(const AssetID& asset_id) const; mutable std::mutex m_lock; - std::map> m_assetid_to_asset_map_path; + std::map m_asset_id_to_asset_map_path; }; } // namespace VideoCommon -- cgit v1.2.3 From d8ea31ca463712fa9d2977807ae0c3b101239fa1 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 17 May 2025 12:20:33 -0500 Subject: VideoCommon: rename GameTextureAsset into TextureAsset and make it only contain CustomTextureData. Move validation and load logic to individual functions --- Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h') diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h index 97f6118969..a3dede8722 100644 --- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h @@ -10,6 +10,7 @@ #include "VideoCommon/Assets/CustomAssetLibrary.h" #include "VideoCommon/Assets/CustomTextureData.h" +#include "VideoCommon/Assets/TextureAsset.h" #include "VideoCommon/Assets/Types.h" namespace VideoCommon @@ -19,7 +20,8 @@ namespace VideoCommon class DirectFilesystemAssetLibrary final : public CustomAssetLibrary { public: - LoadInfo LoadTexture(const AssetID& asset_id, TextureData* data) override; + LoadInfo LoadTexture(const AssetID& asset_id, TextureAndSamplerData* data) override; + LoadInfo LoadTexture(const AssetID& asset_id, CustomTextureData* data) override; LoadInfo LoadPixelShader(const AssetID& asset_id, PixelShaderData* data) override; LoadInfo LoadMaterial(const AssetID& asset_id, MaterialData* data) override; LoadInfo LoadMesh(const AssetID& asset_id, MeshData* data) override; @@ -30,9 +32,6 @@ public: void SetAssetIDMapData(const AssetID& asset_id, Assets::AssetMap asset_path_map); private: - // Loads additional mip levels into the texture structure until _mip texture is not found - bool LoadMips(const std::filesystem::path& asset_path, CustomTextureData::ArraySlice* data); - // Gets the asset map given an asset id Assets::AssetMap GetAssetMapForID(const AssetID& asset_id) const; -- cgit v1.2.3 From d940d62caecc9428ae42726575083b82e699e9f4 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Thu, 4 Jul 2024 17:39:21 -0500 Subject: VideoCommon: watch texture pack folder for texture reloads (from dynamic input textures) --- Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h') diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h index a3dede8722..e3a8e81334 100644 --- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h @@ -8,16 +8,16 @@ #include #include -#include "VideoCommon/Assets/CustomAssetLibrary.h" #include "VideoCommon/Assets/CustomTextureData.h" #include "VideoCommon/Assets/TextureAsset.h" #include "VideoCommon/Assets/Types.h" +#include "VideoCommon/Assets/WatchableFilesystemAssetLibrary.h" namespace VideoCommon { // This class implements 'CustomAssetLibrary' and loads any assets // directly from the filesystem -class DirectFilesystemAssetLibrary final : public CustomAssetLibrary +class DirectFilesystemAssetLibrary final : public WatchableFilesystemAssetLibrary { public: LoadInfo LoadTexture(const AssetID& asset_id, TextureAndSamplerData* data) override; @@ -32,10 +32,15 @@ public: void SetAssetIDMapData(const AssetID& asset_id, Assets::AssetMap asset_path_map); private: + void PathModified(std::string_view path) override; + // Gets the asset map given an asset id Assets::AssetMap GetAssetMapForID(const AssetID& asset_id) const; - mutable std::mutex m_lock; + mutable std::mutex m_asset_map_lock; std::map m_asset_id_to_asset_map_path; + + mutable std::mutex m_path_map_lock; + std::map> m_path_to_asset_id; }; } // namespace VideoCommon -- cgit v1.2.3