Puffin profiler window
This commit is contained in:
parent
10dfe4f22c
commit
a622696fe9
|
@ -9,3 +9,5 @@ egui = "0.17.0"
|
|||
egui-winit = "0.17.0"
|
||||
egui_wgpu_backend = "0.17.0"
|
||||
pollster = "0.2"
|
||||
puffin = "^0.13"
|
||||
puffin_egui = "0.14.0"
|
||||
|
|
|
@ -96,10 +96,15 @@ impl Application {
|
|||
Err(wgpu::SurfaceError::Lost) => self.on_resize(self.size),
|
||||
Err(e) => panic!("Surface error: {:?}", e),
|
||||
Ok(surface_texture) => {
|
||||
let raw_input = self.egui_state.take_egui_input(&self.window);
|
||||
let output = self.egui_ctx.run(raw_input, |ctx| {
|
||||
self.ui.run(ctx);
|
||||
});
|
||||
puffin::GlobalProfiler::lock().new_frame();
|
||||
|
||||
let output = {
|
||||
puffin::profile_scope!("Draw egui");
|
||||
let raw_input = self.egui_state.take_egui_input(&self.window);
|
||||
self.egui_ctx.run(raw_input, |ctx| self.ui.run(ctx))
|
||||
};
|
||||
|
||||
puffin::profile_scope!("Render egui");
|
||||
|
||||
self.egui_state.handle_platform_output(
|
||||
&self.window,
|
||||
|
|
|
@ -65,7 +65,10 @@ impl UserInterface {
|
|||
|
||||
ui.menu_button("View", |ui| {
|
||||
ui.checkbox(&mut self.developer_mode, "Developer mode");
|
||||
ui.checkbox(&mut self.show_profiler, "Show profiler");
|
||||
|
||||
if ui.checkbox(&mut self.show_profiler, "Profiler").changed() {
|
||||
puffin_egui::puffin::set_scopes_on(self.show_profiler);
|
||||
}
|
||||
});
|
||||
|
||||
ui.menu_button("Help", |ui| {
|
||||
|
@ -81,6 +84,10 @@ impl UserInterface {
|
|||
ui.heading("Hello world!");
|
||||
});
|
||||
|
||||
if self.show_profiler {
|
||||
self.show_profiler = puffin_egui::profiler_window(ctx);
|
||||
}
|
||||
|
||||
if self.show_about {
|
||||
egui::Window::new("About")
|
||||
.open(&mut self.show_about)
|
||||
|
|
Loading…
Reference in New Issue