forked from 1b-agent/opencadstudio-upstream
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:
1 parent
d74cb891f9
commit
0f40cfa054
4 files changed
+93
-14
No files matched your search
+15
-1
@@ -184,7 +184,21 @@ is now free. The full camera/selection-from-tessellation split is still open
|
||||
and needs running-app verification (highlight colour is baked into
|
||||
`WireModel.color` across several tessellation sites).
|
||||
|
||||
### 3.2 Persistent GPU buffer pool — diff upload
|
||||
### 3.2 Persistent GPU buffer pool — diff upload ✅ DONE (wire pan path)
|
||||
|
||||
Wire vertex buffers are world-space, so a camera move alone never changes
|
||||
them — only the `view_proj` uniform (already uploaded per frame). The wire
|
||||
upload was gated on `(geometry_epoch, camera_generation)`, re-sending every
|
||||
pan. Now each Model-tile tessellation is stamped with a monotonic content id
|
||||
(`WIRE_CONTENT_GEN`), reused when a pan reuses the tessellation; the pipeline
|
||||
holds the resident buffer's id and `upload_wires` is skipped when it matches.
|
||||
Gate is independent of the camera tick so a preview/interim change still
|
||||
uploads. Non-tile paths and overlay frames force a fresh id (unchanged
|
||||
behaviour). Monotonic id avoids the ABA hazard of a raw `Arc` pointer.
|
||||
|
||||
Still open: a true `HashMap<Handle, GpuSlot>` per-entity pool for partial
|
||||
edits (re-upload only the changed slots); this covers the whole-buffer
|
||||
pan/idle case, the dominant one.
|
||||
|
||||
Today every wire GPU buffer is re-uploaded when
|
||||
[`cached_epoch`](src/scene/pipeline/mod.rs#L101) changes. A persistent
|
||||
|
||||
Reference in new issue
Block a user