Merge pull request #6102 from dotCooCoo/fix/huge-selection-brackets-test

Tests: huge-selection vertex counts leave out the art's raster
This commit is contained in:
BFlat
2026-11-08 13:40:15 +08:00
committed by GitHub
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()
}