2023-06-02 00:57:57 +00:00
|
|
|
// Copyright 2023 Dolphin Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace VideoCommon
|
|
|
|
{
|
2023-07-03 02:27:24 +00:00
|
|
|
struct MaterialData;
|
2024-02-13 00:42:01 +00:00
|
|
|
struct MeshData;
|
2023-06-29 05:56:06 +00:00
|
|
|
struct PixelShaderData;
|
2023-09-06 05:16:26 +00:00
|
|
|
struct TextureData;
|
2023-06-02 00:57:57 +00:00
|
|
|
|
|
|
|
// This class provides functionality to load
|
|
|
|
// specific data (like textures). Where this data
|
|
|
|
// is loaded from is implementation defined
|
|
|
|
class CustomAssetLibrary
|
|
|
|
{
|
|
|
|
public:
|
2023-08-13 21:46:37 +00:00
|
|
|
using TimeType = std::chrono::system_clock::time_point;
|
2023-06-02 00:57:57 +00:00
|
|
|
|
|
|
|
// The AssetID is a unique identifier for a particular asset
|
|
|
|
using AssetID = std::string;
|
|
|
|
|
|
|
|
struct LoadInfo
|
|
|
|
{
|
2023-07-16 17:56:03 +00:00
|
|
|
std::size_t m_bytes_loaded = 0;
|
2023-11-25 23:01:42 +00:00
|
|
|
TimeType m_load_time = {};
|
2023-06-02 00:57:57 +00:00
|
|
|
};
|
|
|
|
|
2023-11-25 22:58:54 +00:00
|
|
|
virtual ~CustomAssetLibrary() = default;
|
|
|
|
|
2023-06-02 00:57:57 +00:00
|
|
|
// Loads a texture, if there are no levels, bytes loaded will be empty
|
2023-09-06 05:16:26 +00:00
|
|
|
virtual LoadInfo LoadTexture(const AssetID& asset_id, TextureData* data) = 0;
|
2023-06-02 00:57:57 +00:00
|
|
|
|
|
|
|
// Gets the last write time for a given asset id
|
|
|
|
virtual TimeType GetLastAssetWriteTime(const AssetID& asset_id) const = 0;
|
|
|
|
|
|
|
|
// Loads a texture as a game texture, providing additional checks like confirming
|
|
|
|
// each mip level size is correct and that the format is consistent across the data
|
2023-09-06 05:16:26 +00:00
|
|
|
LoadInfo LoadGameTexture(const AssetID& asset_id, TextureData* data);
|
2023-06-29 05:56:06 +00:00
|
|
|
|
|
|
|
// Loads a pixel shader
|
|
|
|
virtual LoadInfo LoadPixelShader(const AssetID& asset_id, PixelShaderData* data) = 0;
|
2023-07-03 02:27:24 +00:00
|
|
|
|
|
|
|
// Loads a material
|
|
|
|
virtual LoadInfo LoadMaterial(const AssetID& asset_id, MaterialData* data) = 0;
|
2024-02-13 00:42:01 +00:00
|
|
|
|
|
|
|
// Loads a mesh
|
|
|
|
virtual LoadInfo LoadMesh(const AssetID& asset_id, MeshData* data) = 0;
|
2023-06-02 00:57:57 +00:00
|
|
|
};
|
|
|
|
} // namespace VideoCommon
|