Repository navigation
Description
After #590, Step 1 can display live trajectories using synchronized snapshots. A separate optimization opportunity remains: unchanged display geometry is rebuilt and submitted to the GPU on every rendered frame.
At current main (6e29f528626bb5ccd9227dab6fa3aebce5430cf9):
display()rebuilds trajectory points, axes and prediction segments, even if the same trajectory snapshot is still displayed.endPoints()uploads the point vertices again for each such draw.- Bucket rendering traverses the maps and prepares/uploads displayed points each frame. It also holds the corresponding map mutex while computing the intensity range and drawing the points.
This is based on source inspection. The redundant work is identifiable, but its contribution to total frame time or odometry time has not yet been measured; no specific speedup is claimed.
Proposed incremental approach:
- Start with trajectory points using the existing
ScanRenderer::PointsGPU,uploadPoints()anddrawPoints(). Reuse the uploaded buffer between data changes. The currentuploadPoints()recreates its allocation, so this first step does not imply in-place updates between snapshots. - Extend the existing renderer for persistent line buffers for trajectory axes and predictions, reusing its position layout and shader setup.
- Handle buckets separately: copy only display fields under the map mutex, then prepare colors and perform GPU work outside it. Use explicit map revisions to avoid copying/rebuilding unchanged maps.
The cache should remain valid until an operation changes its source. Invalidation must cover new trajectory snapshots, loading/resetting a recording, manual interval corrections (Accept Gizmo), consistency/smoothing, and bucket updates or resets. Changes to poses must refresh affected geometry even if the vertex count stays the same. Camera movement and display-only parameters such as point size should not rebuild geometry.
Validation should preserve live points, axes, predictions, colors and depth behavior during processing, pause/resume and after completion. It should also check reloads and post-processing corrections, demonstrate no geometry uploads for unchanged visible data, and measure CPU preparation/upload costs and frame times before and after on the same recording and settings. Snapshot-copy and memory costs should be included when assessing the result.
Is anyone already planning or working on this? If not, I can prepare a small follow-up PR starting with trajectory points, then address lines and buckets separately.
Activity
dancmari commentedon Oct 31, 2026
Implemented in #599.
The PR covers the complete Step 1 display path, reuses the existing renderer/vertex types and rlgl buffers, and moves bucket preparation/drawing outside map locks. It contains only functional source changes.
One controlled recording comparison reduced processing time from 418.63 s to 284.75 s (32.0%), with byte-identical pose dumps, the same iteration count and almost unchanged peak resident memory. The PR describes the test conditions and remaining manual checks.