diff --git a/examples/common/boilerplate.rs b/examples/common/boilerplate.rs index b6bf25e68e..9f70707fa1 100644 --- a/examples/common/boilerplate.rs +++ b/examples/common/boilerplate.rs @@ -164,7 +164,6 @@ pub fn main_wrapper( precache_flags: E::PRECACHE_SHADER_FLAGS, device_pixel_ratio, clear_color: Some(ColorF::new(0.3, 0.0, 0.0, 1.0)), - //scatter_gpu_cache_updates: false, debug_flags, //allow_texture_swizzling: false, ..options.unwrap_or(webrender::RendererOptions::default()) diff --git a/webrender/src/device/gl.rs b/webrender/src/device/gl.rs index 1bfad787c1..f77bbe388a 100644 --- a/webrender/src/device/gl.rs +++ b/webrender/src/device/gl.rs @@ -790,7 +790,7 @@ impl ProgramSourceInfo { let source_and_digest = SHADERS.get(&name).expect("Shader not found"); // Hash the renderer name. - hasher.write(device.renderer_name.as_bytes()); + hasher.write(device.capabilities.renderer_name.as_bytes()); // Hash the prefix string. build_shader_prefix_string( @@ -999,6 +999,8 @@ pub struct Capabilities { pub supports_nonzero_pbo_offsets: bool, /// Whether the driver supports specifying the texture usage up front. pub supports_texture_usage: bool, + /// The name of the renderer, as reported by GL + pub renderer_name: String, } #[derive(Clone, Debug)] @@ -1083,7 +1085,6 @@ pub struct Device { max_texture_size: i32, max_texture_layers: u32, - renderer_name: String, cached_programs: Option>, // Frame counter. This is used to map between CPU @@ -1554,6 +1555,7 @@ impl Device { supports_texture_swizzle, supports_nonzero_pbo_offsets, supports_texture_usage, + renderer_name, }, color_formats, @@ -1578,7 +1580,6 @@ impl Device { max_texture_size, max_texture_layers, - renderer_name, cached_programs, frame_id: GpuFrameId(0), extensions, @@ -1998,7 +1999,7 @@ impl Device { error!( "Failed to load a program object with a program binary: {} renderer {}\n{}", &info.base_filename, - self.renderer_name, + self.capabilities.renderer_name, error_log ); if let Some(ref program_cache_handler) = cached_programs.program_cache_handler { diff --git a/webrender/src/renderer.rs b/webrender/src/renderer.rs index 49becbd30d..281b71a2d1 100644 --- a/webrender/src/renderer.rs +++ b/webrender/src/renderer.rs @@ -2231,9 +2231,19 @@ impl Renderer { let transforms_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( &mut device, - options.scatter_gpu_cache_updates, + is_angle, )?; device.end_frame(); @@ -6608,7 +6618,6 @@ pub struct RendererOptions { pub enable_clear_scissor: bool, pub max_texture_size: Option, pub max_glyph_cache_size: Option, - pub scatter_gpu_cache_updates: bool, pub upload_method: UploadMethod, pub workers: Option>, pub enable_multithreading: bool, @@ -6679,8 +6688,6 @@ impl Default for RendererOptions { enable_clear_scissor: true, max_texture_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, // but we are unable to make this decision here, so picking the reasonable medium. upload_method: UploadMethod::PixelBuffer(VertexUsageHint::Stream),