perf counter macros

This commit is contained in:
2021-10-31 16:12:32 +01:00
parent 33bea8fbc8
commit bee1b66b55
10 changed files with 136 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
use std::time::Instant;
use cgmath::{Deg, Euler, Quaternion, vec3};
use glyph_brush::GlyphBrush;
use rust_engine_proc::perf;
use winit::event::Event;
use level::{load_level, save_level};
@@ -56,9 +57,8 @@ impl Game for TestGame {
self.input.on_window_event(event);
}
#[perf("update", crate::perf::PerformanceCounter)]
fn update(self: &mut Self, renderer: &mut VulkanRenderer) {
let precise_start = Instant::now();
// Input and timing
self.input.frame_start();
let time = (renderer.game_data.start_time.elapsed().unwrap().as_micros() as f64 / 1000000.0) as f32;
@@ -126,9 +126,6 @@ impl Game for TestGame {
_dummy1: [0; 4],
_dummy2: [0; 4],
};
let precise_duration = precise_start.elapsed().as_micros();
renderer.game_data.update_perf_counters[renderer.game_data.performance_counter_index] = precise_duration;
}
fn get_ubo(&self) -> &vs::ty::ObjectUniformData {