Asset Loading
EntropyPortal employs a designated service pipeline for loading assets, separating the concerns of fetching, parsing, and GPU upload.
Architecture Overview
Section titled “Architecture Overview”The asset pipeline is split into three distinct layers:
graph TD
Network[Network / VFS] -->|Raw Bytes| Loader[AssetLoaderService]
Loader -->|Cached Bytes| Parser[Canvas SDK Parsers]
Parser -->|TextureData| TexService[TextureService]
Parser -->|MeshData| MeshService[MeshService]
Parser -->|Slang Source| ShaderService[ShaderCompilerService]
TexService -->|Upload| GPU[GpuRenderDevice]
MeshService -->|Upload| GPU
ShaderService -->|Compile & Create PSO| GPU
1. Fetching Layer (AssetLoaderService)
Section titled “1. Fetching Layer (AssetLoaderService)”The AssetLoaderService is responsible for retrieving raw asset data from the source (Network or Disk).
- Resolution: Uses
AssetClientto resolveAssetIdto a URI (e.g.,https://...orfile://...). - Caching: Maintains an LRU cache of decrypted, ready-to-use bytes.
- Security: Handles AES-256-GCM decryption and hash verification transparently.
2. Parsing Layer (EntropyCanvas SDK)
Section titled “2. Parsing Layer (EntropyCanvas SDK)”Once raw bytes are retrieved, they are parsed by the EntropyCanvas SDK.
- Textures: Parsed into
EntropyCanvas::TextureData(pixel formatting, dimensions). - Meshes: Parsed into
EntropyCanvas::MeshData(vertex streams, indices).
3. GPU Management Layer
Section titled “3. GPU Management Layer”The resource services take parsed data and manage the GPU lifecycle.
- Meshes/Textures: Schedule non-blocking transfers to the GPU.
- Shaders: The
ShaderCompilerServicemanages a pool of compilers to asynchronously compile Slang source into GPU bytecode (SPIR-V/DXIL/MSL) and create Pipeline State Objects (PSOs). - Lookup: All services provide
getByAssetIdlookups.
Data Flow Example
Section titled “Data Flow Example”// 1. Fetch (Async)assetLoader->loadAsset(assetId, [](const AssetLoadResult& result) {
// 2. Parse (e.g., Texture) auto textureData = EntropyCanvas::TextureLoader::parse(result.data);
// 3. Create GPU Resource auto texture = textureService->createTextureFromData(textureData);
// 4. Register for Lookup textureService->registerTextureWithAssetId(texture.get(), assetId);
// 5. Schedule Upload textureService->requestTextureUpload(texture, std::move(textureData));});