perf(scene): skip wire GPU re-upload when only the camera moved
Phase 3.2 (wire pan path). Wire vertex buffers are world-space, so a camera move changes only the view_proj uniform (uploaded every frame), never the wire data — yet upload_wires re-ran on every camera_generation tick, re-packing vertices and re-writing the GPU buffer on each pan. Stamp every Model-tile re-tessellation with a monotonic content id (WIRE_CONTENT_GEN), reused when a pan reuses the tessellation. The pipeline records the resident buffer's id and skips upload_wires when the incoming id matches. The gate is pulled out of the (epoch, camera_gen) block so a preview/interim wire change still uploads even with a static camera; non-tile paths and overlay frames force a fresh id, preserving current behaviour. Monotonic id sidesteps the ABA hazard a freed/realloc'd Arc pointer would carry. Pairs with the pan tessellation reuse: a pan now skips both the CPU re-tessellation and the GPU wire upload. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
d74cb891f9
commit
0f40cfa054
4 changed files with 93 additions and 14 deletions
|
|
@ -116,6 +116,12 @@ pub struct Pipeline {
|
|||
/// were uploaded. We re-upload when either side changes — pan/zoom bumps
|
||||
/// camera_generation, which triggers re-culling and a fresh upload.
|
||||
pub cached_epoch: (u64, u64),
|
||||
/// Content id of the wire buffer currently resident on the GPU (Phase
|
||||
/// 3.2). When the incoming `ViewportData.wire_content_id` matches, the
|
||||
/// world-space wire vertices are unchanged (e.g. a pure pan reused the
|
||||
/// Model-tile tessellation) and `upload_wires` is skipped. `u64::MAX` =
|
||||
/// nothing uploaded yet.
|
||||
pub cached_wire_id: u64,
|
||||
}
|
||||
|
||||
impl Pipeline {
|
||||
|
|
@ -884,6 +890,7 @@ impl Pipeline {
|
|||
gpu_face3d_edges: vec![],
|
||||
viewcube,
|
||||
cached_epoch: (u64::MAX, u64::MAX),
|
||||
cached_wire_id: u64::MAX,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue