Fix issues found while integrating performance PRs

This commit is contained in:
Hakan Seven committed 2026-09-08 17:33:02 +03:00
1 parent 2b510c1a1e
commit 4972bbed70
6 files changed
+78 -213

No files matched your search

+3 -13
View File
@@ -251,9 +251,7 @@ pub struct Pipeline {
pub(crate) wire_arena_fallback_handles: rustc_hash::FxHashSet<acadrust::Handle>,
/// The Model content id both arenas currently mirror (`u64::MAX` = none).
pub(crate) wire_arena_id: u64,
/// Entities that fed the instanced / circle / ellipse uploads this slot is
/// holding. A patch touching none of them cannot change those uploads, so
/// the partition walk over the whole resident set can be skipped.
/// Handles that contributed to this slot's retained analytical uploads.
pub(crate) partition_contributors: rustc_hash::FxHashSet<acadrust::Handle>,
/// The draw-depth generation those uploads baked. A full depth rebuild
/// reassigns every label, so they stop being reusable when it moves.
@@ -4961,12 +4959,7 @@ impl Pipeline {
}
}
/// Forget every cache key that describes this slot's uploaded content.
///
/// Shared by slot reuse and by [`Self::release_heavy_resources`] so the two
/// cannot disagree about what "this slot holds nothing you can trust"
/// means. Keys only — the buffers themselves are dropped by the caller that
/// wants the memory back.
/// Reset every cache key that describes this slot's uploaded content.
pub(crate) fn forget_cached_keys(&mut self) {
self.cached_epoch = (u64::MAX, u64::MAX, u64::MAX);
self.cached_wire_id = u64::MAX;
@@ -4989,10 +4982,7 @@ impl Pipeline {
self.silhouette_key = (usize::MAX, u64::MAX, [u32::MAX; 3], false);
self.silhouette_source_key = (usize::MAX, usize::MAX, u64::MAX);
self.render_sig = u64::MAX;
// The partition record describes uploads this slot is no longer
// entitled to reuse. A reused slot rebuilds anyway, because its content
// id changed, but leaving a stale record here would make that an
// accident rather than a guarantee.
// The retained-upload record is part of the slot's cached state.
self.partition_contributors.clear();
self.partition_depth_generation = u64::MAX;
}
+7 -27
View File
@@ -174,33 +174,16 @@ pub struct PartitionedWires<'a> {
pub instanced: Vec<&'a WireModel>,
pub circle_instances: Vec<super::circle_gpu::CircleInstance>,
pub ellipse_instances: Vec<super::ellipse_gpu::EllipseInstance>,
/// Entities that fed `instanced` / `circle_instances` / `ellipse_instances`.
///
/// A patch that touches none of these cannot change those three uploads, so
/// the caller can keep the ones it already has and skip the walk entirely.
/// Handles that contributed to the retained analytical uploads.
pub contributors: rustc_hash::FxHashSet<Handle>,
}
/// Whether a change to this wire can alter what `partition_wires` produces for
/// the instanced, circle and ellipse uploads.
///
/// Decided by attempting the extraction, exactly as the walk decides it. The
/// cheap structural test alone is not enough: an ordinary drawn line carries a
/// tangent geom for snapping and no triangles, so it passes that test, fails
/// extraction, and lands in `regular` — a membership test that stopped there
/// would call every line a contributor and never skip anything.
///
/// `draw_depth` only rides along in the extracted instance, so the value passed
/// here cannot change the answer.
/// Whether this wire contributes to an upload retained across arena patches.
pub fn feeds_analytical_uploads(wire: &WireModel) -> bool {
if !wire.display_visible {
return false;
}
if wire.render_instance.is_some() {
return true;
}
super::circle_gpu::extract_circle_instances(wire, 0.0).is_some()
|| super::ellipse_gpu::extract_ellipse_instances(wire, 0.0).is_some()
matches!(
classify_wire(wire),
WireKind::Block | WireKind::Circle | WireKind::Ellipse
)
}
/// Single-pass classification and extraction of all viewport wire categories.
@@ -233,10 +216,7 @@ pub fn partition_wires<'a>(
instanced.push(wire);
continue;
}
// `wire_draw_depth` is a hash lookup and its result is used only by the
// analytical extractions below, which most wires never reach. Computing
// it first cost one lookup per resident wire on every patch — 236 956
// of them for the ~56 000 that are circles or ellipses.
// Resolve draw depth only for wires eligible for analytical extraction.
if !wire.tangent_geoms.is_empty()
&& wire.fill_tris.is_empty()
&& wire.pick_tris.is_empty()