Bug 1715058 - Disable annotation of draw call crashes. r=gfx-reviewers,gw

These annotations were useful for fixing crashes without known steps
to reproduce in the past, but the frequency of setting and unsetting
the annotations has a measurable impact on performance. This patch
therefore disables the annotations, but keeps the code behind a flag
so that it can easily be enabled if required for a future bug.

Differential Revision: https://phabricator.services.mozilla.com/D117152
This commit is contained in:
Jamie Nicol 2021-06-09 07:36:51 +00:00
Родитель 86d6f5a49e
Коммит 4fdb81d73c
1 изменённых файлов: 56 добавлений и 30 удалений

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

@ -1097,6 +1097,7 @@ pub struct Device {
// debug
inside_frame: bool,
crash_annotator: Option<Box<dyn CrashAnnotator>>,
annotate_draw_call_crashes: bool,
// resources
resource_override_path: Option<PathBuf>,
@ -1728,6 +1729,7 @@ impl Device {
gl,
base_gl: None,
crash_annotator,
annotate_draw_call_crashes: false,
resource_override_path,
use_optimized_shaders,
upload_method,
@ -3446,11 +3448,15 @@ impl Device {
#[cfg(debug_assertions)]
debug_assert!(self.shader_is_ready);
let _guard = CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
);
let _guard = if self.annotate_draw_call_crashes {
Some(CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
))
} else {
None
};
self.gl.draw_elements(
gl::TRIANGLES,
@ -3465,11 +3471,15 @@ impl Device {
#[cfg(debug_assertions)]
debug_assert!(self.shader_is_ready);
let _guard = CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
);
let _guard = if self.annotate_draw_call_crashes {
Some(CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
))
} else {
None
};
self.gl.draw_elements(
gl::TRIANGLES,
@ -3484,11 +3494,15 @@ impl Device {
#[cfg(debug_assertions)]
debug_assert!(self.shader_is_ready);
let _guard = CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
);
let _guard = if self.annotate_draw_call_crashes {
Some(CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
))
} else {
None
};
self.gl.draw_arrays(gl::POINTS, first_vertex, vertex_count);
}
@ -3498,11 +3512,15 @@ impl Device {
#[cfg(debug_assertions)]
debug_assert!(self.shader_is_ready);
let _guard = CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
);
let _guard = if self.annotate_draw_call_crashes {
Some(CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
))
} else {
None
};
self.gl.draw_arrays(gl::LINES, first_vertex, vertex_count);
}
@ -3512,11 +3530,15 @@ impl Device {
#[cfg(debug_assertions)]
debug_assert!(self.shader_is_ready);
let _guard = CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
);
let _guard = if self.annotate_draw_call_crashes {
Some(CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
))
} else {
None
};
self.gl.draw_elements(
gl::TRIANGLES,
@ -3531,11 +3553,15 @@ impl Device {
#[cfg(debug_assertions)]
debug_assert!(self.shader_is_ready);
let _guard = CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
);
let _guard = if self.annotate_draw_call_crashes {
Some(CrashAnnotatorGuard::new(
&self.crash_annotator,
CrashAnnotation::DrawShader,
&self.bound_program_name,
))
} else {
None
};
self.gl.draw_elements_instanced(
gl::TRIANGLES,