None draft
authorpulselistener
Fri, 16 Aug 2019 13:24:16 +0000
changeset 2220742 0c6322e35a82ae33ef9c53b227fb3e0b9377774f
parent 2220470 5d4cbfe103bbc517599231eb33d4f3ebbbcede40
child 2220743 b76efe8f52f454c177b53ba5a8350c4940007fb3
push id406997
push userreviewbot
push dateFri, 16 Aug 2019 13:25:48 +0000
treeherdertry@b76efe8f52f4 [default view] [failures only]
milestone70.0a1
None Differential Diff: PHID-DIFF-ljxsvanlztfccgtpf2zv
gfx/webrender_bindings/src/bindings.rs
gfx/wr/webrender/src/renderer.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1216,16 +1216,17 @@ pub extern "C" fn wr_window_new(window_i
         // The color is for avoiding black flash before receiving display list.
         ColorF::new(1.0, 1.0, 1.0, 1.0)
     } else {
         ColorF::new(0.0, 0.0, 0.0, 0.0)
     };
 
     let opts = RendererOptions {
         enable_aa: true,
+        force_subpixel_aa: false,
         enable_subpixel_aa: cfg!(not(target_os = "android")),
         support_low_priority_transactions,
         allow_texture_swizzling,
         recorder: recorder,
         blob_image_handler: Some(Box::new(Moz2dBlobImageHandler::new(workers.clone()))),
         workers: Some(workers.clone()),
         thread_listener: Some(Box::new(GeckoProfilerThreadListener::new())),
         size_of_op: Some(size_of_op),
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -2028,17 +2028,18 @@ impl Renderer {
             &mut device,
             options.scatter_gpu_cache_updates,
         )?;
 
         device.end_frame();
 
         let backend_notifier = notifier.clone();
 
-        let default_font_render_mode = match (options.enable_aa, options.enable_subpixel_aa) {
+        let prefer_subpixel_aa = options.force_subpixel_aa || (options.enable_subpixel_aa && use_dual_source_blending);
+        let default_font_render_mode = match (options.enable_aa, prefer_subpixel_aa) {
             (true, true) => FontRenderMode::Subpixel,
             (true, false) => FontRenderMode::Alpha,
             (false, _) => FontRenderMode::Mono,
         };
 
         let config = FrameBuilderConfig {
             default_font_render_mode,
             dual_source_blending_is_enabled: true,
@@ -5484,17 +5485,20 @@ bitflags! {
 pub struct RendererOptions {
     pub device_pixel_ratio: f32,
     pub resource_override_path: Option<PathBuf>,
     pub enable_aa: bool,
     pub enable_dithering: bool,
     pub max_recorded_profiles: usize,
     pub precache_flags: ShaderPrecacheFlags,
     pub renderer_kind: RendererKind,
+    /// Enable sub-pixel anti-aliasing if a fast implementation is available.
     pub enable_subpixel_aa: bool,
+    /// Enable sub-pixel anti-aliasing if it requires a slow implementation.
+    pub force_subpixel_aa: bool,
     pub clear_color: Option<ColorF>,
     pub enable_clear_scissor: bool,
     pub max_texture_size: Option<i32>,
     pub max_glyph_cache_size: Option<usize>,
     pub scatter_gpu_cache_updates: bool,
     pub upload_method: UploadMethod,
     pub workers: Option<Arc<ThreadPool>>,
     pub blob_image_handler: Option<Box<dyn BlobImageHandler>>,
@@ -5547,16 +5551,17 @@ impl Default for RendererOptions {
             resource_override_path: None,
             enable_aa: true,
             enable_dithering: true,
             debug_flags: DebugFlags::empty(),
             max_recorded_profiles: 0,
             precache_flags: ShaderPrecacheFlags::empty(),
             renderer_kind: RendererKind::Native,
             enable_subpixel_aa: false,
+            force_subpixel_aa: false,
             clear_color: Some(ColorF::new(1.0, 1.0, 1.0, 1.0)),
             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.