mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-09 12:21:31 +11:00
[frame_stats] Reduce stats time delta between elapsed() and next frame start time
This does not account for the time spent in processing `Stats::add_sample` but it should be very close.
This commit is contained in:
parent
a1c0df1058
commit
02a222f435
|
@ -368,10 +368,11 @@ fn run(
|
||||||
surface_texture.present();
|
surface_texture.present();
|
||||||
device_handle.device.poll(wgpu::Maintain::Poll);
|
device_handle.device.poll(wgpu::Maintain::Poll);
|
||||||
|
|
||||||
|
let new_time = Instant::now();
|
||||||
stats.add_sample(stats::Sample {
|
stats.add_sample(stats::Sample {
|
||||||
frame_time_us: frame_start_time.elapsed().as_micros() as u64,
|
frame_time_us: (new_time - frame_start_time).as_micros() as u64,
|
||||||
});
|
});
|
||||||
frame_start_time = Instant::now();
|
frame_start_time = new_time;
|
||||||
}
|
}
|
||||||
Event::UserEvent(event) => match event {
|
Event::UserEvent(event) => match event {
|
||||||
#[cfg(not(any(target_arch = "wasm32", target_os = "android")))]
|
#[cfg(not(any(target_arch = "wasm32", target_os = "android")))]
|
||||||
|
|
Loading…
Reference in a new issue