Tests: huge-selection vertex counts leave out the art's raster

The huge type-on-a-path selection test compares the canvas mesh drawn with
the Rectangle tool against the one drawn with the Selection tool. When the
render worker's frame lands between the two (a slow first frame under heavy
load), the art's textured quad shows in only one of them, and the test
counted its 4 vertices as brackets.

canvas_vertices and frame_vertices now skip the mesh drawn with the canvas
art texture, so the counts hold only what the overlays draw. A huge
selection of type, images, symbols or meshes used the same comparison.
This commit is contained in:
dotCooCoo
2026-11-08 12:23:52 +07:00
committed by bflatastic
parent 8a7011a9d3
commit 7b8fccf785
2 changed files with 14 additions and 4 deletions
+7 -2
View File
@@ -1602,13 +1602,18 @@ fn shapes(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec<Shape> {
}
/// Two headless canvas frames → the vertices of the second one's tessellated mesh, which the
/// GPU takes in one buffer.
/// GPU takes in one buffer, without the art's raster: the render worker's frame can land in
/// either frame of a comparison.
fn frame_vertices(app: &mut VectorcraftApp, ctx: &egui::Context) -> usize {
frame(app, ctx, vec![]);
let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))), ..Default::default() };
let mut out = ctx.run_ui(raw, |ui| show(app, ui));
out.textures_delta.clear();
let mesh = |p: &egui::ClippedPrimitive| if let egui::epaint::Primitive::Mesh(m) = &p.primitive { m.vertices.len() } else { 0 };
let art = app.canvas.texture.as_ref().map(|t| t.id());
let mesh = |p: &egui::ClippedPrimitive| match &p.primitive {
egui::epaint::Primitive::Mesh(m) if Some(m.texture_id) != art => m.vertices.len(),
_ => 0,
};
ctx.tessellate(out.shapes, out.pixels_per_point).iter().map(mesh).sum()
}
+7 -2
View File
@@ -30,13 +30,18 @@ fn open_options(app: &mut VectorcraftApp) {
}
/// Two headless canvas frames → the vertices of the second one's tessellated mesh, which the GPU
/// takes in one buffer.
/// takes in one buffer, without the art's raster: the render worker's frame can land in either
/// frame of a comparison.
fn canvas_vertices(app: &mut VectorcraftApp, ctx: &egui::Context) -> usize {
let raw = || egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))), ..Default::default() };
ctx.run_ui(raw(), |ui| crate::canvas::show(app, ui)).textures_delta.clear();
let mut out = ctx.run_ui(raw(), |ui| crate::canvas::show(app, ui));
out.textures_delta.clear();
let mesh = |p: &egui::ClippedPrimitive| if let egui::epaint::Primitive::Mesh(m) = &p.primitive { m.vertices.len() } else { 0 };
let art = app.canvas.texture.as_ref().map(|t| t.id());
let mesh = |p: &egui::ClippedPrimitive| match &p.primitive {
egui::epaint::Primitive::Mesh(m) if Some(m.texture_id) != art => m.vertices.len(),
_ => 0,
};
ctx.tessellate(out.shapes, out.pixels_per_point).iter().map(mesh).sum()
}