Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
TextureAssetPipeline.h
1#pragma once
2#include <filesystem>
3#include <future>
4#include <vector>
5
6#include "Engine/Ecs/EcsData.h"
7
8class NamedThreadPool;
9
10namespace Engine::Assets
11{
13} // namespace Engine::Assets
14
15namespace Engine
16{
17 class EngineKern;
18}
19
20namespace Engine::Core
21{
22 class AssetManager;
23 class RenderingDataManager;
24}
25
26namespace Engine::Ecs
27{
32 friend class Core::AssetManager;
33 friend class EngineKern;
34
35 public:
42 Assets::TextureAssetManager * textureAssetManager, NamedThreadPool * assetLoaderPool );
43
48 void submitAsset(const std::filesystem::path &asset);
49
54 void tick(bool async = true);
55
60 void setRenderingDataManager( Engine::Core::RenderingDataManager * renderingDataManager) { renderingDataManager_ = renderingDataManager; }
61
66 void setMaxTexturesPerFrame(size_t max) { maxTexturesPerFrame_ = max; }
67
72 size_t getPendingCount() const {
73 return assetQueue_.size() + exrHeaderFutures_.size() + imageFutures_.size() + ktx2LoadFutures_.size();
74 }
75
80
81 private:
82 void requestExrHeaders(bool async = true);
83 void loadImageData(bool async = true);
84 void retrieveImageData(bool async = true);
85 void processKtx2Textures(bool async = true);
86
88 Core::RenderingDataManager * renderingDataManager_ = nullptr;
89 NamedThreadPool* assetLoaderPool_ = nullptr;
90
91 std::vector<std::filesystem::path> assetQueue_;
92 std::vector<std::filesystem::path> ktx2Queue_;
93 std::vector<ExrHeaderFuture> exrHeaderFutures_;
94 std::vector<AssetLoadingImage> imageFutures_;
95 std::vector<Ktx2LoadFuture> ktx2LoadFutures_;
96
98 };
99
100} // namespace Engine::Ecs
Asset manager for texture assets keyed by filesystem path.
Coordinates engine asset loading pipelines and runtime texture descriptor ownership.
std::vector< std::filesystem::path > ktx2Queue_
std::vector< ExrHeaderFuture > exrHeaderFutures_
size_t getPendingCount() const
Returns the number of textures still pending in the pipeline.
std::vector< Ktx2LoadFuture > ktx2LoadFutures_
TextureAssetPipeline(Assets::TextureAssetManager *textureAssetManager, NamedThreadPool *assetLoaderPool)
Create a texture asset loading pipeline.
Core::RenderingDataManager * renderingDataManager_
void setRenderingDataManager(Engine::Core::RenderingDataManager *renderingDataManager)
Sets the RenderingDataManager to notify when textures are loaded.
std::vector< std::filesystem::path > assetQueue_
void processKtx2Textures(bool async=true)
void retrieveImageData(bool async=true)
size_t maxTexturesPerFrame_
Rate limit for texture processing per frame.
std::vector< AssetLoadingImage > imageFutures_
Assets::TextureAssetManager * textureAssetManager_
void discardPendingWork()
Clears all queued and in-flight texture loading work.
void tick(bool async=true)
Advances the state machine for the entire pipeline.
void loadImageData(bool async=true)
void submitAsset(const std::filesystem::path &asset)
submit the path to an asset relative from the executable to load
void requestExrHeaders(bool async=true)
void setMaxTexturesPerFrame(size_t max)
Sets the maximum number of textures to process per frame.
Owns the engine runtime and provides access to engine subsystems.
Definition Engine.h:67
EnTT component data used by engine systems.