зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1629693 - Enable GPU cache scatter path when running ANGLE. r=kvark
On some (mostly older, integrated) GPUs, the normal GPU texture cache update path doesn't work well when running on ANGLE, causing CPU stalls inside D3D and/or the GPU driver. To reduce the number of code paths we have active that require testing, we will enable the GPU cache scatter update path on all devices running with ANGLE. We want a better solution long-term, but for now this is a significant performance improvement on HD4600 era GPUs, and shouldn't hurt performance in a noticeable way on other systems running under ANGLE. Differential Revision: https://phabricator.services.mozilla.com/D70764 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
25e565834b
Коммит
7eee44a592
|
@ -164,7 +164,6 @@ pub fn main_wrapper<E: Example>(
|
||||||
precache_flags: E::PRECACHE_SHADER_FLAGS,
|
precache_flags: E::PRECACHE_SHADER_FLAGS,
|
||||||
device_pixel_ratio,
|
device_pixel_ratio,
|
||||||
clear_color: Some(ColorF::new(0.3, 0.0, 0.0, 1.0)),
|
clear_color: Some(ColorF::new(0.3, 0.0, 0.0, 1.0)),
|
||||||
//scatter_gpu_cache_updates: false,
|
|
||||||
debug_flags,
|
debug_flags,
|
||||||
//allow_texture_swizzling: false,
|
//allow_texture_swizzling: false,
|
||||||
..options.unwrap_or(webrender::RendererOptions::default())
|
..options.unwrap_or(webrender::RendererOptions::default())
|
||||||
|
|
|
@ -790,7 +790,7 @@ impl ProgramSourceInfo {
|
||||||
let source_and_digest = SHADERS.get(&name).expect("Shader not found");
|
let source_and_digest = SHADERS.get(&name).expect("Shader not found");
|
||||||
|
|
||||||
// Hash the renderer name.
|
// Hash the renderer name.
|
||||||
hasher.write(device.renderer_name.as_bytes());
|
hasher.write(device.capabilities.renderer_name.as_bytes());
|
||||||
|
|
||||||
// Hash the prefix string.
|
// Hash the prefix string.
|
||||||
build_shader_prefix_string(
|
build_shader_prefix_string(
|
||||||
|
@ -999,6 +999,8 @@ pub struct Capabilities {
|
||||||
pub supports_nonzero_pbo_offsets: bool,
|
pub supports_nonzero_pbo_offsets: bool,
|
||||||
/// Whether the driver supports specifying the texture usage up front.
|
/// Whether the driver supports specifying the texture usage up front.
|
||||||
pub supports_texture_usage: bool,
|
pub supports_texture_usage: bool,
|
||||||
|
/// The name of the renderer, as reported by GL
|
||||||
|
pub renderer_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -1083,7 +1085,6 @@ pub struct Device {
|
||||||
|
|
||||||
max_texture_size: i32,
|
max_texture_size: i32,
|
||||||
max_texture_layers: u32,
|
max_texture_layers: u32,
|
||||||
renderer_name: String,
|
|
||||||
cached_programs: Option<Rc<ProgramCache>>,
|
cached_programs: Option<Rc<ProgramCache>>,
|
||||||
|
|
||||||
// Frame counter. This is used to map between CPU
|
// Frame counter. This is used to map between CPU
|
||||||
|
@ -1554,6 +1555,7 @@ impl Device {
|
||||||
supports_texture_swizzle,
|
supports_texture_swizzle,
|
||||||
supports_nonzero_pbo_offsets,
|
supports_nonzero_pbo_offsets,
|
||||||
supports_texture_usage,
|
supports_texture_usage,
|
||||||
|
renderer_name,
|
||||||
},
|
},
|
||||||
|
|
||||||
color_formats,
|
color_formats,
|
||||||
|
@ -1578,7 +1580,6 @@ impl Device {
|
||||||
|
|
||||||
max_texture_size,
|
max_texture_size,
|
||||||
max_texture_layers,
|
max_texture_layers,
|
||||||
renderer_name,
|
|
||||||
cached_programs,
|
cached_programs,
|
||||||
frame_id: GpuFrameId(0),
|
frame_id: GpuFrameId(0),
|
||||||
extensions,
|
extensions,
|
||||||
|
@ -1998,7 +1999,7 @@ impl Device {
|
||||||
error!(
|
error!(
|
||||||
"Failed to load a program object with a program binary: {} renderer {}\n{}",
|
"Failed to load a program object with a program binary: {} renderer {}\n{}",
|
||||||
&info.base_filename,
|
&info.base_filename,
|
||||||
self.renderer_name,
|
self.capabilities.renderer_name,
|
||||||
error_log
|
error_log
|
||||||
);
|
);
|
||||||
if let Some(ref program_cache_handler) = cached_programs.program_cache_handler {
|
if let Some(ref program_cache_handler) = cached_programs.program_cache_handler {
|
||||||
|
|
|
@ -2231,9 +2231,19 @@ impl Renderer {
|
||||||
let transforms_texture = VertexDataTexture::new(&mut device, ImageFormat::RGBAF32);
|
let transforms_texture = VertexDataTexture::new(&mut device, ImageFormat::RGBAF32);
|
||||||
let render_task_texture = VertexDataTexture::new(&mut device, ImageFormat::RGBAF32);
|
let render_task_texture = VertexDataTexture::new(&mut device, ImageFormat::RGBAF32);
|
||||||
|
|
||||||
|
// On some (mostly older, integrated) GPUs, the normal GPU texture cache update path
|
||||||
|
// doesn't work well when running on ANGLE, causing CPU stalls inside D3D and/or the
|
||||||
|
// GPU driver. See https://bugzilla.mozilla.org/show_bug.cgi?id=1576637 for much
|
||||||
|
// more detail. To reduce the number of code paths we have active that require testing,
|
||||||
|
// we will enable the GPU cache scatter update path on all devices running with ANGLE.
|
||||||
|
// We want a better solution long-term, but for now this is a significant performance
|
||||||
|
// improvement on HD4600 era GPUs, and shouldn't hurt performance in a noticeable
|
||||||
|
// way on other systems running under ANGLE.
|
||||||
|
let is_angle = device.get_capabilities().renderer_name.contains("ANGLE");
|
||||||
|
|
||||||
let gpu_cache_texture = GpuCacheTexture::new(
|
let gpu_cache_texture = GpuCacheTexture::new(
|
||||||
&mut device,
|
&mut device,
|
||||||
options.scatter_gpu_cache_updates,
|
is_angle,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
device.end_frame();
|
device.end_frame();
|
||||||
|
@ -6608,7 +6618,6 @@ pub struct RendererOptions {
|
||||||
pub enable_clear_scissor: bool,
|
pub enable_clear_scissor: bool,
|
||||||
pub max_texture_size: Option<i32>,
|
pub max_texture_size: Option<i32>,
|
||||||
pub max_glyph_cache_size: Option<usize>,
|
pub max_glyph_cache_size: Option<usize>,
|
||||||
pub scatter_gpu_cache_updates: bool,
|
|
||||||
pub upload_method: UploadMethod,
|
pub upload_method: UploadMethod,
|
||||||
pub workers: Option<Arc<ThreadPool>>,
|
pub workers: Option<Arc<ThreadPool>>,
|
||||||
pub enable_multithreading: bool,
|
pub enable_multithreading: bool,
|
||||||
|
@ -6679,8 +6688,6 @@ impl Default for RendererOptions {
|
||||||
enable_clear_scissor: true,
|
enable_clear_scissor: true,
|
||||||
max_texture_size: None,
|
max_texture_size: None,
|
||||||
max_glyph_cache_size: None,
|
max_glyph_cache_size: None,
|
||||||
// Scattered GPU cache updates haven't met a test that would show their superiority yet.
|
|
||||||
scatter_gpu_cache_updates: false,
|
|
||||||
// This is best as `Immediate` on Angle, or `Pixelbuffer(Dynamic)` on GL,
|
// This is best as `Immediate` on Angle, or `Pixelbuffer(Dynamic)` on GL,
|
||||||
// but we are unable to make this decision here, so picking the reasonable medium.
|
// but we are unable to make this decision here, so picking the reasonable medium.
|
||||||
upload_method: UploadMethod::PixelBuffer(VertexUsageHint::Stream),
|
upload_method: UploadMethod::PixelBuffer(VertexUsageHint::Stream),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче