Skip to content

LOD GPU roadmap Phase 2: asynchronous transfers, lifetime, and memory #919

Description

@MichaelFisher1997

Goal

Remove full-device stalls and make streaming uploads/lifetime management predictable before GPU-driven rendering increases buffer traffic.

Depends on

Phase 0 metrics. Coordinate interfaces with Phase 1 MDI work.

Workstreams

These touch shared Vulkan infrastructure and should merge in dependency order, although design/prototyping can proceed in parallel.

Resource lifetime

  • Replace LOD eviction and pool growth vkDeviceWaitIdle use with fence/timeline-based retirement.
  • Tag retired buffers/ranges with the last submission value and reclaim only after completion.
  • Bound deferred-retirement memory and expose pressure metrics.

Upload path

  • Implement a persistent mapped/ring staging strategy with bounded per-frame allocation.
  • Enforce byte budgets even for the first upload of a frame.
  • Split or defer oversized uploads without starving near regions.
  • Prefer GPU buffer-copy operations during pool migration over CPU shadow re-upload.

Pooling and accounting

  • Lazily allocate LOD pools only when pooled rendering is active.
  • Account for pool capacity/slack, CPU shadows, pending vertices, direct buffers, deferred resources, and allocator overhead.
  • Add an enforced resident-region and total LOD memory limit.
  • Define fragmentation, growth, and optional compaction policies without frame-global synchronization.

Relevant code

  • modules/world-lod/src/lod_manager_eviction_ops.zig
  • modules/world-lod/src/lod_vertex_pool.zig
  • modules/world-lod/src/lod_mesh_resources.zig
  • modules/world-lod/src/lod_manager_upload_ops.zig
  • modules/engine-graphics/src/vulkan/resource_manager.zig
  • modules/engine-graphics/src/vulkan/rhi_state_control.zig

Acceptance criteria

  • Normal streaming, eviction, resize, and compaction execute without vkDeviceWaitIdle.
  • Resource destruction is demonstrably safe across frames in flight.
  • Upload bytes and staging pressure remain within configured budgets.
  • Teleport/rapid traversal does not produce periodic synchronization hitches.
  • Reported LOD CPU/VRAM totals match allocated capacity within a documented tolerance.

Risks

Incorrect retirement values can cause use-after-free on GPU. Ring wraparound and transfer/graphics queue ownership must be explicitly tested. Keep a conservative fallback for unsupported timeline semaphore paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationengineenhancementNew feature or requestperf/bandwidthVertex/data bandwidth optimizationperf/renderingRendering pipeline performance

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions