Group primitive timings in Present span
This commit is contained in:
parent
e6da449c92
commit
8338435429
3 changed files with 79 additions and 80 deletions
|
|
@ -23,16 +23,10 @@ pub enum Span {
|
|||
Draw {
|
||||
window: window::Id,
|
||||
},
|
||||
Prepare {
|
||||
window: window::Id,
|
||||
primitive: Primitive,
|
||||
},
|
||||
Render {
|
||||
window: window::Id,
|
||||
primitive: Primitive,
|
||||
},
|
||||
Present {
|
||||
window: window::Id,
|
||||
prepare: present::Stage,
|
||||
render: present::Stage,
|
||||
layers: usize,
|
||||
},
|
||||
Custom {
|
||||
|
|
@ -40,43 +34,6 @@ pub enum Span {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Hash,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
pub enum Primitive {
|
||||
Quad,
|
||||
Triangle,
|
||||
Shader,
|
||||
Text,
|
||||
Image,
|
||||
}
|
||||
|
||||
impl Span {
|
||||
pub fn stage(&self) -> Stage {
|
||||
match self {
|
||||
Span::Boot => Stage::Boot,
|
||||
Span::Update { .. } => Stage::Update,
|
||||
Span::View { window } => Stage::View(*window),
|
||||
Span::Layout { window } => Stage::Layout(*window),
|
||||
Span::Interact { window } => Stage::Interact(*window),
|
||||
Span::Draw { window } => Stage::Draw(*window),
|
||||
Span::Prepare { primitive, .. } => Stage::Prepare(*primitive),
|
||||
Span::Render { primitive, .. } => Stage::Render(*primitive),
|
||||
Span::Present { window, .. } => Stage::Present(*window),
|
||||
Span::Custom { name, .. } => Stage::Custom(name.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
|
||||
)]
|
||||
|
|
@ -88,8 +45,8 @@ pub enum Stage {
|
|||
Interact(window::Id),
|
||||
Draw(window::Id),
|
||||
Present(window::Id),
|
||||
Prepare(Primitive),
|
||||
Render(Primitive),
|
||||
Prepare(present::Primitive),
|
||||
Render(present::Primitive),
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
|
|
@ -109,3 +66,38 @@ impl std::fmt::Display for Stage {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub mod present {
|
||||
use crate::core::time::Duration;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
pub struct Stage {
|
||||
pub quads: Duration,
|
||||
pub triangles: Duration,
|
||||
pub shaders: Duration,
|
||||
pub text: Duration,
|
||||
pub images: Duration,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Hash,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
pub enum Primitive {
|
||||
Quad,
|
||||
Triangle,
|
||||
Shader,
|
||||
Text,
|
||||
Image,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue