diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index f630d801d..d289a0403 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -1602,13 +1602,18 @@ fn shapes(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec { } /// 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() } diff --git a/crates/ui-egui/src/tests/pathtype.rs b/crates/ui-egui/src/tests/pathtype.rs index 46f5eff67..4a14c1e0f 100644 --- a/crates/ui-egui/src/tests/pathtype.rs +++ b/crates/ui-egui/src/tests/pathtype.rs @@ -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() }