debug: Add profiler view

This commit is contained in:
Victoria Brekenfeld 2023-03-06 18:48:52 +01:00
parent d2b049332c
commit 26743d6bdc
4 changed files with 140 additions and 4 deletions

View file

@ -29,6 +29,31 @@ pub const RENDER_COLOR: Color32 = Color32::from_rgb(29, 114, 58);
pub const SCREENCOPY_COLOR: Color32 = Color32::from_rgb(253, 178, 39);
pub const DISPLAY_COLOR: Color32 = Color32::from_rgb(41, 184, 209);
pub fn profiler_ui(
state: &mut Common,
renderer: &mut GlowRenderer,
area: Rectangle<i32, Logical>,
scale: f64,
) -> Result<Option<TextureRenderElement<Gles2Texture>>, Gles2Error> {
if !state.egui.active {
return Ok(None);
}
state
.egui
.state
.render(
|ctx| {
puffin_egui::profiler_window(ctx);
},
renderer,
area,
scale,
0.8,
)
.map(Some)
}
pub fn fps_ui(
gpu: Option<&DrmNode>,
state: &Common,