blob: b4831ea6506e80363a35eabf5f735ab42c43dc3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// 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
{
struct MaterialData;
struct MeshData;
struct PixelShaderData;
struct TextureData;
// This class provides functionality to load
// specific data (like textures). Where this data
// is loaded from is implementation defined
class CustomAssetLibrary
{
public:
using TimeType = std::chrono::system_clock::time_point;
// The AssetID is a unique identifier for a particular asset
using AssetID = std::string;
struct LoadInfo
{
std::size_t m_bytes_loaded = 0;
TimeType m_load_time = {};
};
virtual ~CustomAssetLibrary() = default;
// Loads a texture, if there are no levels, bytes loaded will be empty
virtual LoadInfo LoadTexture(const AssetID& asset_id, TextureData* data) = 0;
// 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
LoadInfo LoadGameTexture(const AssetID& asset_id, TextureData* data);
// Loads a pixel shader
virtual LoadInfo LoadPixelShader(const AssetID& asset_id, PixelShaderData* data) = 0;
// Loads a material
virtual LoadInfo LoadMaterial(const AssetID& asset_id, MaterialData* data) = 0;
// Loads a mesh
virtual LoadInfo LoadMesh(const AssetID& asset_id, MeshData* data) = 0;
};
} // namespace VideoCommon
|