Expand description
Backend-agnostic planner for the incremental RT acceleration-structure topology refresh. When the participating draw set changes at runtime (a cloned prop, a streamed chunk added/removed), the BLAS head must be brought back in line with the current set without rebuilding every BLAS: reuse every BLAS whose geometry slice is unchanged, build only the new ones, and retire the orphans. This module owns only the pure decision (which slot reuses which old BLAS, which are orphaned); the actual GPU allocation / build / retire is per-backend (directx/raytrace.rs, vulkan/raytrace.rs). Split out so the plan is unit-testable without a GPU.
Consumed by the DirectX + Vulkan backends. The Metal backend predates this module and keeps its own equivalent copy (metal/raytrace.rs); a future cleanup could converge it here once Metal can be rebuilt alongside.
Structs§
- GeomSig
- Identifies the geometry a draw-object BLAS traces, on the shared
vertex/index buffers. Two draw objects with the same signature trace
identical geometry, so a topology refresh can reuse the existing BLAS instead
of building a new one. A streamed mesh is placed wherever the sub-allocator
has room, so a slot that streams out and back in generally returns on a
different slice; the signature moves with it and the BLAS is rebuilt rather
than wrongly reused.
base_vertex+index_offset+index_countare exactly the inputs the per-backend geometry descriptor uses;vertex_offsetis carried too so a static draw (whosebase_vertexis 0) still distinguishes distinct vertex regions. - Topology
Plan - Per-new-slot decision for a topology refresh of the draw-object BLAS head.
Functions§
- plan_
topology_ refresh - Decide, for the draw-object BLAS head only, which BLAS to reuse, which to
build, and which to retire when the participating draw set changes. Matches
old and new slots by
draw_objectsindex AND geometry signature: a slot whose geometry moved (a chunk slot recycled for a different chunk) does not match, so it rebuilds. Pure so it is unit-testable without a GPU.