Report layers rendered to iced_beacon
This commit is contained in:
parent
fae95d6095
commit
613c706a39
6 changed files with 45 additions and 6 deletions
|
|
@ -48,6 +48,7 @@ pub enum Event {
|
|||
MessageLogged { number: usize, message: String },
|
||||
CommandsSpawned(usize),
|
||||
SubscriptionsTracked(usize),
|
||||
LayersRendered(usize),
|
||||
}
|
||||
|
||||
impl Client {
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ pub fn run() -> impl Stream<Item = Event> {
|
|||
let mut last_tasks = 0;
|
||||
let mut last_subscriptions = 0;
|
||||
let mut last_present_window = None;
|
||||
let mut last_present_layers = 0;
|
||||
|
||||
drop(task::spawn(async move {
|
||||
let mut last_message_number = None;
|
||||
|
|
@ -199,6 +200,9 @@ pub fn run() -> impl Stream<Item = Event> {
|
|||
) => {
|
||||
last_tasks = commands;
|
||||
}
|
||||
client::Event::LayersRendered(layers) => {
|
||||
last_present_layers = layers;
|
||||
}
|
||||
client::Event::SpanStarted(
|
||||
span::Stage::Update,
|
||||
) => {
|
||||
|
|
@ -264,7 +268,10 @@ pub fn run() -> impl Stream<Item = Event> {
|
|||
}
|
||||
}
|
||||
span::Stage::Present(window) => {
|
||||
Span::Present { window }
|
||||
Span::Present {
|
||||
window,
|
||||
layers: last_present_layers,
|
||||
}
|
||||
}
|
||||
span::Stage::Custom(name) => {
|
||||
Span::Custom { name }
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ pub enum Span {
|
|||
},
|
||||
Present {
|
||||
window: window::Id,
|
||||
layers: usize,
|
||||
},
|
||||
Custom {
|
||||
name: String,
|
||||
|
|
@ -70,7 +71,7 @@ impl Span {
|
|||
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::Present { window, .. } => Stage::Present(*window),
|
||||
Span::Custom { name, .. } => Stage::Custom(name.clone()),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,15 @@ pub fn theme_changed(f: impl FnOnce() -> Option<theme::Palette>) {
|
|||
}
|
||||
|
||||
pub fn tasks_spawned(amount: usize) {
|
||||
internal::tasks_spawned(amount)
|
||||
internal::tasks_spawned(amount);
|
||||
}
|
||||
|
||||
pub fn subscriptions_tracked(amount: usize) {
|
||||
internal::subscriptions_tracked(amount)
|
||||
internal::subscriptions_tracked(amount);
|
||||
}
|
||||
|
||||
pub fn layers_rendered(amount: impl FnOnce() -> usize) {
|
||||
internal::layers_rendered(amount);
|
||||
}
|
||||
|
||||
pub fn boot() -> Span {
|
||||
|
|
@ -157,6 +161,10 @@ mod internal {
|
|||
log(client::Event::SubscriptionsTracked(amount));
|
||||
}
|
||||
|
||||
pub fn layers_rendered(amount: impl FnOnce() -> usize) {
|
||||
log(client::Event::LayersRendered(amount()));
|
||||
}
|
||||
|
||||
pub fn boot() -> Span {
|
||||
span(span::Stage::Boot)
|
||||
}
|
||||
|
|
@ -300,8 +308,6 @@ mod internal {
|
|||
use crate::futures::Subscription;
|
||||
use crate::{Command, Primitive};
|
||||
|
||||
use std::io;
|
||||
|
||||
pub fn enable() {}
|
||||
pub fn disable() {}
|
||||
|
||||
|
|
@ -317,6 +323,8 @@ mod internal {
|
|||
|
||||
pub fn subscriptions_tracked(_amount: usize) {}
|
||||
|
||||
pub fn layers_rendered(_amount: impl FnOnce() -> usize) {}
|
||||
|
||||
pub fn boot() -> Span {
|
||||
Span
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,16 @@ pub struct Layer {
|
|||
}
|
||||
|
||||
impl Layer {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.quads.is_empty()
|
||||
&& self.triangles.is_empty()
|
||||
&& self.primitives.is_empty()
|
||||
&& self.images.is_empty()
|
||||
&& self.text.is_empty()
|
||||
&& self.pending_meshes.is_empty()
|
||||
&& self.pending_text.is_empty()
|
||||
}
|
||||
|
||||
pub fn draw_quad(
|
||||
&mut self,
|
||||
quad: renderer::Quad,
|
||||
|
|
|
|||
|
|
@ -604,6 +604,18 @@ impl Renderer {
|
|||
}
|
||||
|
||||
let _ = ManuallyDrop::into_inner(render_pass);
|
||||
|
||||
debug::layers_rendered(|| {
|
||||
self.layers
|
||||
.iter()
|
||||
.filter(|layer| {
|
||||
!layer.is_empty()
|
||||
&& physical_bounds
|
||||
.intersection(&(layer.bounds * scale_factor))
|
||||
.is_some_and(|viewport| viewport.snap().is_some())
|
||||
})
|
||||
.count()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue