revert: drop wire segment caps that silently truncated geometry

Remove MAX_SEGS_PER_WIRE = 100_000 and MAX_TOTAL_SEGS = 3_000_000.
These were stop-gap GPU-memory guards that mutated visible output:
single complex entities were cut mid-geometry, and entire wires past
the 3M total were dropped by arrival order with no spatial awareness.
Either is worse than honestly drawing whatever the file contains —
truncated arcs and missing road segments look like bugs to the user,
not "we ran out of GPU memory."

The matching "Temporary Workarounds" section in
RENDERING_OPTIMIZATION.md goes with them. Per-entity LOD and
viewport culling (Phase 1 + 3.2 in the same doc) remain the right
long-term answer; until they land, prefer correctness over a soft
crash on pathological files.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hakan 2026-05-13 10:11:54 +03:00
commit 9b6d5437fa
3 changed files with 3 additions and 94 deletions

View file

@ -600,36 +600,7 @@ impl Pipeline {
}
pub fn upload_wires(&mut self, device: &wgpu::Device, wires: &[WireModel]) {
// Total segment budget: prevents a large file from exhausting GPU memory.
// Each segment → 6 GPU vertices × 96 bytes = 576 bytes; 3M segs ≈ 1.6 GB.
const MAX_TOTAL_SEGS: usize = 3_000_000;
let mut total_segs = 0usize;
let mut skipped = 0usize;
self.gpu_wires = wires
.iter()
.filter(|w| {
let segs = w
.points
.len()
.saturating_sub(1)
.min(wire_gpu::MAX_SEGS_PER_WIRE);
if total_segs + segs > MAX_TOTAL_SEGS {
skipped += 1;
false
} else {
total_segs += segs;
true
}
})
.map(|w| WireGpu::new(device, w))
.collect();
if skipped > 0 {
eprintln!(
"[H7CAD] upload_wires: skipped {skipped} wire(s) — total segment budget ({MAX_TOTAL_SEGS}) exceeded"
);
}
self.gpu_wires = wires.iter().map(|w| WireGpu::new(device, w)).collect();
// Full-brightness copies of selected wires, drawn on top of everything
// in the selection overlay pass so they're always visible.