fix(paper): reset a reused viewport GPU slot so the survivor keeps its content
Pipeline slots are addressed by list index, but the renderer drops off-canvas viewports from the list, so a slot can be reused by a different viewport across frames — e.g. when the first paper viewport scrolls off the canvas the second slides into its slot and inherits its stale, differently frustum-culled GPU buffers. The text upload is gated on a geometry-epoch change (unaffected by the index shift), so the survivor rendered the gone viewport's text and its own vanished. Give each viewport a stable identity, remember which one last used a slot, and reset all cache keys when the occupant changes so wires, text, hatches, meshes and Face3D re-upload for the new viewport. No cost in the steady state — the reset fires only when a viewport enters/leaves view. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1884f622c2
commit
31d3023167
2 changed files with 41 additions and 0 deletions
|
|
@ -228,6 +228,12 @@ pub struct Pipeline {
|
|||
/// `render` skips the (per-pixel, GPU-dominating) hatch pass this frame. The
|
||||
/// scene-render cache holds the full-quality frame once the view settles.
|
||||
pub skip_hatch_frame: bool,
|
||||
/// Stable identity of the viewport that last used this (index-addressed)
|
||||
/// pipeline slot. The renderer's viewport list drops off-canvas viewports,
|
||||
/// so a slot can be reused by a *different* viewport across frames; when the
|
||||
/// occupant changes, all cache keys above belong to the previous one and are
|
||||
/// reset so every buffer re-uploads. `u64::MAX` = never used.
|
||||
pub slot_id: u64,
|
||||
}
|
||||
|
||||
impl Pipeline {
|
||||
|
|
@ -1226,6 +1232,7 @@ impl Pipeline {
|
|||
render_sig: u64::MAX,
|
||||
skip_geometry: false,
|
||||
skip_hatch_frame: false,
|
||||
slot_id: u64::MAX,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue