| Crates.io | archetype_asset |
| lib.rs | archetype_asset |
| version | 0.2.1 |
| created_at | 2025-12-05 15:44:23.225798+00 |
| updated_at | 2026-01-12 07:28:03.761032+00 |
| description | Fast, modular asset system with spatial preloading |
| homepage | |
| repository | https://github.com/saptak-santra/archetype_asset |
| max_upload_size | |
| id | 1968492 |
| size | 284,541 |
A modular asset pipeline that handles the "boring" parts of loading files into GPU memory.
archetype_asset is a high-performance bridge between files on disk and data in your GPU. It follows the "Dumb Pipe" philosophy: it handles the messy parsing, parallel decoding, and memory management, but stays out of your way when it comes to actual rendering.
Fair Warning: This is a library component, not a engine. You'll need to provide your own GpuDevice implementation (though a Mock is provided for testing) and your own rendering logic. Think of it as the gas station for your car—it provides the fuel, but you still have to drive.
meshopt.ash, wgpu, or your own).The heart of the system. It manages memory budgets and handles deduplication.
use archetype_asset::cache::AssetCache;
use archetype_asset::gpu::mock::MockGpu;
use archetype_asset::runtime::tokio::TokioSpawner;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// 1. Initialize your GPU backend and async spawner
let gpu = MockGpu::new();
let spawner = TokioSpawner::new();
// 2. Create the cache with a 256MB memory budget
let cache = AssetCache::new(gpu, spawner, 256 * 1024 * 1024);
// 3. Load a model (parallel decoding happens here)
let model = cache.get_or_load_model("assets/character.glb").await?;
println!("Loaded {} meshes for the GPU", model.meshes.len());
Ok(())
}
Stop your game from stuttering when moving through large worlds.
// Update player position to trigger background preloading
cache.update_player_position(vec3(100.0, 0.0, -50.0)).await;
// Call this once per frame to progress the preload queue
cache.frame_update(player_pos).await;
Load massive HDR cubemaps without the memcpy tax.
use archetype_asset::ibl::MappedIblAsset;
fn load_lighting() -> anyhow::Result<()> {
let ibl = MappedIblAsset::load("assets/skybox.aibl")?;
let raw_data = ibl.cubemap_data(); // Slices straight into the memory-map
Ok(())
}
We take performance seriously because we have to.
DashMap concurrency.Benchmarks run on: Intel Core i5-11400F, Intel Arc A380, 16GB RAM.
Data flows from disk to GPU in a clean, isolated stream:
mmap).AsyncSpawner).AssetMemoryPool.DashMap.GpuDevice implementation.lod feature (depends on meshopt).AssetCache to be generic over AsyncSpawner.DashMap for concurrent performance.await-holding-lock deadlocks in spatial updates.