forked from 1b-agent/opencadstudio-upstream
Phase 4-B (batched hatch pipeline) is in; Phase 4.1 (multi-draw indirect / GPU compute cull) stays as a deliberate non-goal because iced 0.14 doesn't expose the required wgpu features to widget pipelines, and the single-draw batched path already collapses N bind-group swaps + N draw calls into one. Phase 4.2 (Hi-Z occlusion) only matters for perspective 3D, which H7CAD doesn't ship. The doc is now a short stub — the per-phase rationale lives at the call sites (search for "Phase N.X" comments). Co-Authored-By: Claude Opus 4.7 <[email protected]>
2.0 KiB
2.0 KiB
Rendering Optimization Roadmap
Phases 1–4 have all landed. This document is kept as a stub so the git history points somewhere; the optimisations themselves are documented inline at the call sites:
- Phase 1 – per-frame LOD ladder, scissor cull (search for
Phase 1.*inscene/pipeline/mod.rs). - Phase 2 – quadtree spatial index for top-level entities, plus
draw-time frustum cull for hatches / wipeouts / meshes
(
Phase 2.1,2.2,2.3). - Phase 3 – LOD substitution for far / sub-pixel content
(
Phase 3.2,3.3,3.4). - Phase 4-B – batched hatch pipeline. Every hatch is uploaded
into shared storage buffers (
hatch_batched_gpu.rs) and drawn in onepass.draw(0..6N, 0..1); the per-instancevisibilitybuffer doubles as a CPU-driven cull mask (sub-pixel + frustum) that the vertex shader honours by emitting an out-of-NDC clip position for skipped instances. Replaces N bind-group swaps + N draw calls with a single draw.
Deliberate non-goals
- Phase 4.1 (multi-draw indirect / compute cull) — iced 0.14
doesn't expose
Features::MULTI_DRAW_INDIRECTto widget pipelines. Without it, single-draw indirect adds no real saving over the current batched draw. Revisit if iced surfaces the feature flag, or if H7CAD ever swaps the shader widget for a custom wgpu surface. - Phase 4.2 (Hi-Z occlusion) — pays off only for perspective 3D with many overlapping opaque meshes. H7CAD is orthographic top-down for every realistic workflow, so the win is theoretical.
- Per-mutation incremental quadtree updates —
entity_index_cacherebuilds lazily ongeometry_epochchange. Full rebuild is ~50 ms on a 100 k-entity doc; promote to per-mutationinsert/remove/updateif profiling shows that as a hot spot during heavy edits. - Per-hatch viewport scissor in the batched path — paper-space
MSPACE viewports can render hatches past the viewport border for
now. Add a per-instance scissor rect (computed from
vp_scissor) if it shows up as a visible artefact.