diff options
| author | JMC47 <JMC4789@gmail.com> | 2025-06-07 15:51:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-07 15:51:34 -0400 |
| commit | 52fcdde4852ccab197092da37b00548e33844d85 (patch) | |
| tree | 02b438f5d1fa1c127f73bdb0a0f12c2678965435 /Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h | |
| parent | 5eb61024c6e94b949ce21eac81003b43587fc155 (diff) | |
| parent | c3d3b8153388866117334cdc719889d1f676a16e (diff) | |
Merge pull request #13386 from iwubcode/resource_manager_system
VideoCommon: add resource manager, tracks resources to load assets in optimal way and manage memory
Diffstat (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h')
| -rw-r--r-- | Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h index c4d99baf82..e3a8e81334 100644 --- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h @@ -8,39 +8,39 @@ #include <mutex> #include <string> -#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: - using AssetMap = std::map<std::string, std::filesystem::path>; - - 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; - // 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 - 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<N> texture is not found - bool LoadMips(const std::filesystem::path& asset_path, CustomTextureData::ArraySlice* data); + void PathModified(std::string_view path) override; // 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_asset_map_lock; + std::map<AssetID, Assets::AssetMap> m_asset_id_to_asset_map_path; - mutable std::mutex m_lock; - std::map<AssetID, std::map<std::string, std::filesystem::path>> m_assetid_to_asset_map_path; + mutable std::mutex m_path_map_lock; + std::map<std::string, AssetID, std::less<>> m_path_to_asset_id; }; } // namespace VideoCommon |
