Bug 1504992 - Update webrender to commit 491476874195158449d209195c9fc429422f5d0c (WR PR #3273). r=kats
authorWR Updater Bot <graphics-team@mozilla.staktrace.com>
Tue, 06 Nov 2018 12:06:02 +0000
changeset 444617 a89a82787eb93d36c0fb76ad860b73e2967670e5
parent 444616 ee70e6495ba8e7c32ba1c927563c65a16f4445bc
child 444618 2f86f12badc1e86b772e8dd95b4f6ff7e60b2d6e
push id34998
push userapavel@mozilla.com
push dateTue, 06 Nov 2018 17:04:36 +0000
treeherdermozilla-central@f9affb18c3e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1504992
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1504992 - Update webrender to commit 491476874195158449d209195c9fc429422f5d0c (WR PR #3273). r=kats Differential Revision: https://phabricator.services.mozilla.com/D11022
gfx/webrender/src/prim_store.rs
gfx/webrender/src/segment.rs
gfx/webrender_bindings/revision.txt
--- a/gfx/webrender/src/prim_store.rs
+++ b/gfx/webrender/src/prim_store.rs
@@ -884,17 +884,17 @@ impl BrushSegment {
             }
             None => {
                 self.clip_task_id = BrushSegmentTaskId::Empty;
             }
         }
     }
 }
 
-pub type BrushSegmentVec = SmallVec<[BrushSegment; 8]>;
+pub type BrushSegmentVec = SmallVec<[BrushSegment; 1]>;
 
 #[derive(Debug)]
 pub struct BrushSegmentDescriptor {
     pub segments: BrushSegmentVec,
 }
 
 pub struct BrushPrimitive {
     pub kind: BrushKind,
--- a/gfx/webrender/src/segment.rs
+++ b/gfx/webrender/src/segment.rs
@@ -172,29 +172,31 @@ impl Item {
 #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd)]
 struct ItemIndex(usize);
 
 // The main public interface to the segment module.
 pub struct SegmentBuilder {
     items: Vec<Item>,
     inner_rect: Option<LayoutRect>,
     bounding_rect: Option<LayoutRect>,
-    
+    has_interesting_clips: bool,
+
     #[cfg(debug_assertions)]
     initialized: bool,
 }
 
 impl SegmentBuilder {
     // Create a new segment builder, supplying the primitive
     // local rect and associated local clip rect.
     pub fn new() -> SegmentBuilder {
         SegmentBuilder {
             items: Vec::with_capacity(4),
             bounding_rect: None,
             inner_rect: None,
+            has_interesting_clips: false,
             #[cfg(debug_assertions)]
             initialized: false,
         }
     }
 
     pub fn initialize(
         &mut self,
         local_rect: LayoutRect,
@@ -202,17 +204,21 @@ impl SegmentBuilder {
         local_clip_rect: LayoutRect,
     ) {
         self.items.clear();
         self.inner_rect = inner_rect;
         self.bounding_rect = Some(local_rect);
 
         self.push_clip_rect(local_rect, None, ClipMode::Clip);
         self.push_clip_rect(local_clip_rect, None, ClipMode::Clip);
-                    
+
+        // This must be set after the push_clip_rect calls above, since we
+        // want to skip segment building if those are the only clips.
+        self.has_interesting_clips = false;
+
         #[cfg(debug_assertions)]
         {
             self.initialized = true;
         }
     }
 
     // Push a region defined by an inner and outer rect where there
     // is a mask required. This ensures that segments which intersect
@@ -221,16 +227,18 @@ impl SegmentBuilder {
     // the pixels of a clip-mask. It might be useful for other types
     // such as dashed and dotted borders in the future.
     pub fn push_mask_region(
         &mut self,
         outer_rect: LayoutRect,
         inner_rect: LayoutRect,
         inner_clip_mode: Option<ClipMode>,
     ) {
+        self.has_interesting_clips = true;
+
         if inner_rect.is_well_formed_and_nonempty() {
             debug_assert!(outer_rect.contains_rect(&inner_rect));
 
             let p0 = outer_rect.origin;
             let p1 = inner_rect.origin;
             let p2 = inner_rect.bottom_right();
             let p3 = outer_rect.bottom_right();
 
@@ -296,16 +304,18 @@ impl SegmentBuilder {
     // Push some kind of clipping region into the segment builder.
     // If radius is None, it's a simple rect.
     pub fn push_clip_rect(
         &mut self,
         rect: LayoutRect,
         radius: Option<BorderRadius>,
         mode: ClipMode,
     ) {
+        self.has_interesting_clips = true;
+
         // Keep track of a minimal bounding rect for the set of
         // segments that will be generated.
         if mode == ClipMode::Clip {
             self.bounding_rect = self.bounding_rect.and_then(|bounding_rect| {
                 bounding_rect.intersection(&rect)
             });
         }
         let mode = Some(mode);
@@ -403,21 +413,40 @@ impl SegmentBuilder {
             }
         }
     }
 
     // Consume this segment builder and produce a list of segments.
     pub fn build<F>(&mut self, mut f: F) where F: FnMut(&Segment) {
         #[cfg(debug_assertions)]
         debug_assert!(self.initialized);
+
+        #[cfg(debug_assertions)]
+        {
+            self.initialized = false;
+        }
+
         let bounding_rect = match self.bounding_rect {
             Some(bounding_rect) => bounding_rect,
             None => return,
         };
 
+        if !self.has_interesting_clips {
+            // There were no additional clips added, so don't bother building segments.
+            // Just emit a single segment for the bounding rect of the primitive.
+            f(&Segment {
+                edge_flags: EdgeAaSegmentMask::all(),
+                region_x: 0,
+                region_y: 0,
+                has_mask: false,
+                rect: bounding_rect,
+            });
+            return
+        }
+
         // First, filter out any items that don't intersect
         // with the visible bounding rect.
         self.items.retain(|item| item.rect.intersects(&bounding_rect));
 
         // Create events for each item
         let mut x_events : SmallVec<[Event; 4]> = SmallVec::new();
         let mut y_events : SmallVec<[Event; 4]> = SmallVec::new();
 
@@ -541,21 +570,16 @@ impl SegmentBuilder {
                 }
 
                 if let Some(ref mut segment) = segments[y * x_count + x] {
                     segment.edge_flags = edge_flags;
                     f(segment);
                 }
             }
         }
-      
-        #[cfg(debug_assertions)]
-        {
-            self.initialized = false;
-        }
     }
 }
 
 fn clamp(low: Au, value: Au, high: Au) -> Au {
     value.max(low).min(high)
 }
 
 fn emit_segment_if_needed(
@@ -672,16 +696,18 @@ mod test {
         expected_segments: &mut [Segment]
     ) {
         let mut sb = SegmentBuilder::new();
         sb.initialize(
             local_rect,
             inner_rect,
             local_clip_rect,
         );
+        sb.push_clip_rect(local_rect, None, ClipMode::Clip);
+        sb.push_clip_rect(local_clip_rect, None, ClipMode::Clip);
         let mut segments = Vec::new();
         for &(rect, radius, mode) in clips {
             sb.push_clip_rect(rect, radius, mode);
         }
         sb.build(|segment| {
             segments.push(Segment {
                 ..*segment
             });
--- a/gfx/webrender_bindings/revision.txt
+++ b/gfx/webrender_bindings/revision.txt
@@ -1,1 +1,1 @@
-6537cd0f366f09af018df717778a3b79c0d8836d
+491476874195158449d209195c9fc429422f5d0c