forked from 1b-agent/opencadstudio-upstream
Fix issues found while integrating performance PRs
This commit is contained in:
1 parent
2b510c1a1e
commit
4972bbed70
6 files changed
+78
-213
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user