Bug 1672836 - Read the profile counters before handing them to the profiler. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D94587
This commit is contained in:
Nicolas Silva 2020-10-23 15:20:35 +00:00
Родитель 8da8e8eeda
Коммит 04d3a4a876
1 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -3758,6 +3758,20 @@ impl Renderer {
self.cpu_profiles.push_back(cpu_profile); self.cpu_profiles.push_back(cpu_profile);
} }
if thread_is_being_profiled() {
let duration = Duration::new(0,0);
let message = (self.profile.get_or(profiler::DRAW_CALLS, 0.0) as usize).to_string();
add_text_marker(cstr!("NumDrawCalls"), &message, duration);
}
results.stats.texture_upload_mb = self.profile.get_or(profiler::TEXTURE_UPLOADS_MEM, 0.0);
self.frame_counter += 1;
results.stats.resource_upload_time = self.resource_upload_time;
self.resource_upload_time = 0.0;
results.stats.gpu_cache_upload_time = self.gpu_cache_upload_time;
self.gpu_cache_upload_time = 0.0;
// Note: this clears the values in self.profile.
self.profiler.set_counters(&mut self.profile); self.profiler.set_counters(&mut self.profile);
// Note: profile counters must be set before this or they will count for next frame. // Note: profile counters must be set before this or they will count for next frame.
@ -3780,19 +3794,6 @@ impl Renderer {
self.device.echo_driver_messages(); self.device.echo_driver_messages();
} }
if thread_is_being_profiled() {
let duration = Duration::new(0,0);
let message = (self.profile.get_or(profiler::DRAW_CALLS, 0.0) as usize).to_string();
add_text_marker(cstr!("NumDrawCalls"), &message, duration);
}
results.stats.texture_upload_mb = self.profile.get_or(profiler::TEXTURE_UPLOADS_MEM, 0.0);
self.frame_counter += 1;
results.stats.resource_upload_time = self.resource_upload_time;
self.resource_upload_time = 0.0;
results.stats.gpu_cache_upload_time = self.gpu_cache_upload_time;
self.gpu_cache_upload_time = 0.0;
if let Some(debug_renderer) = self.debug.try_get_mut() { if let Some(debug_renderer) = self.debug.try_get_mut() {
let small_screen = self.debug_flags.contains(DebugFlags::SMALL_SCREEN); let small_screen = self.debug_flags.contains(DebugFlags::SMALL_SCREEN);
let scale = if small_screen { 1.6 } else { 1.0 }; let scale = if small_screen { 1.6 } else { 1.0 };