Skip to main content

Module projection

Module projection 

Source
Expand description

CPU→GPU mesh + material projection — the data-layer replacement for MeshPreparationSystem.

ProjectionRegistry is created once in engine.rs bootstrap, registered into ServiceRegistry, and called via sync_all() in tick_with_services() before the scheduler dispatches agents.

After sync_all() returns for a given frame, every entity that has a HandleComponent<Mesh> also has a HandleComponent<GpuMesh>, and the shared GpuCache is fully up to date. This call is idempotent: entities already holding a HandleComponent<GpuMesh> are skipped via the Without<HandleComponent<GpuMesh>> query filter.

Materials are projected per-variant with no fallback textures: a material’s [ShaderVariantKey] is exactly the set of maps it declares, and the cached group-2 bind group is built against the same (LayoutKey::Material, variant) layout the lit pipeline binds. A mesh with no resolved material handle (and no pending MaterialRef), or a material referencing a texture absent from the Assets<CpuTexture> store, is logged and skipped rather than silently substituted.

Structs§

ProjectionRegistry
Engine-wide CPU→GPU mesh + material upload service.