1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

"Final" touch-ups on wgpu integration

This commit is contained in:
Emil Ernerfeldt
2023-11-14 07:58:04 +01:00
parent 274cdea620
commit aad7ed23d2
5 changed files with 171 additions and 207 deletions

View File

@@ -9,6 +9,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
{
let ctx = egui::Context::default();
let mut demo_windows = egui_demo_lib::DemoWindows::default();
let pixels_per_point = 1.0;
// The most end-to-end benchmark.
c.bench_function("demo_with_tessellate__realistic", |b| {
@@ -16,7 +17,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let full_output = ctx.run(RawInput::default(), |ctx| {
demo_windows.ui(ctx);
});
ctx.tessellate(full_output.shapes)
ctx.tessellate(full_output.shapes, pixels_per_point)
});
});
@@ -32,7 +33,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
demo_windows.ui(ctx);
});
c.bench_function("demo_only_tessellate", |b| {
b.iter(|| ctx.tessellate(full_output.shapes.clone()));
b.iter(|| ctx.tessellate(full_output.shapes.clone(), pixels_per_point));
});
}

View File

@@ -71,13 +71,14 @@ fn test_egui_e2e() {
let mut demo_windows = crate::DemoWindows::default();
let ctx = egui::Context::default();
let raw_input = egui::RawInput::default();
let pixels_per_point = 1.0;
const NUM_FRAMES: usize = 5;
for _ in 0..NUM_FRAMES {
let full_output = ctx.run(raw_input.clone(), |ctx| {
demo_windows.ui(ctx);
});
let clipped_primitives = ctx.tessellate(full_output.shapes);
let clipped_primitives = ctx.tessellate(full_output.shapes, pixels_per_point);
assert!(!clipped_primitives.is_empty());
}
}
@@ -90,13 +91,14 @@ fn test_egui_zero_window_size() {
screen_rect: Some(egui::Rect::from_min_max(egui::Pos2::ZERO, egui::Pos2::ZERO)),
..Default::default()
};
let pixels_per_point = 1.0;
const NUM_FRAMES: usize = 5;
for _ in 0..NUM_FRAMES {
let full_output = ctx.run(raw_input.clone(), |ctx| {
demo_windows.ui(ctx);
});
let clipped_primitives = ctx.tessellate(full_output.shapes);
let clipped_primitives = ctx.tessellate(full_output.shapes, pixels_per_point);
assert!(
clipped_primitives.is_empty(),
"There should be nothing to show, has at least one primitive with clip_rect: {:?}",