Bug 1501525 - Update webrender to b5463c2074813237098804f4f0219cf1ba6c6984. r=kats
authorWR Updater Bot <graphics-team@mozilla.staktrace.com>
Wed, 24 Oct 2018 10:51:48 +0000
changeset 491093 8519f45d19d6b4ec0541cbe324248dfb33284abf
parent 491092 9a97be306a98f430af645ddf735f49ab57e043b8
child 491094 16c6eb0e476f5fae58fd0271bc95ef67c81b373b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerskats
bugs1501525
milestone65.0a1
Bug 1501525 - Update webrender to b5463c2074813237098804f4f0219cf1ba6c6984. r=kats Differential Revision: https://phabricator.services.mozilla.com/D9635
gfx/webrender/src/glyph_rasterizer/pathfinder.rs
gfx/webrender/src/render_task.rs
gfx/webrender/src/tiling.rs
gfx/webrender_bindings/revision.txt
--- a/gfx/webrender/src/glyph_rasterizer/pathfinder.rs
+++ b/gfx/webrender/src/glyph_rasterizer/pathfinder.rs
@@ -297,26 +297,26 @@ fn request_render_task_from_pathfinder(g
     // FIXME(pcwalton): Support vertical subpixel offsets.
     // FIXME(pcwalton): Embolden amount should be 0 on macOS if "Use LCD font
     // smoothing" is unchecked in System Preferences.
 
     let subpixel_offset = TypedPoint2D::new(glyph_subpixel_offset as f32, 0.0);
     let embolden_amount = compute_embolden_amount(size.to_f32_px());
 
     let location = RenderTaskLocation::Dynamic(None, *glyph_size);
-    let glyph_render_task = RenderTask::new_glyph(location,
+    let glyph_render_task = RenderTask::new_glyph(location.clone(),
                                                   mesh,
                                                   &glyph_origin,
                                                   &subpixel_offset,
                                                   font.render_mode,
                                                   &embolden_amount);
 
     let root_task_id = render_tasks.add(glyph_render_task);
     let render_pass = match render_mode {
         FontRenderMode::Mono | FontRenderMode::Alpha => &mut render_passes.alpha_glyph_pass,
         FontRenderMode::Subpixel => &mut render_passes.color_glyph_pass,
     };
-    render_pass.add_render_task(root_task_id, *glyph_size, RenderTargetKind::Color);
+    render_pass.add_render_task(root_task_id, *glyph_size, RenderTargetKind::Color, &location);
 
     Ok(root_task_id)
 }
 
 pub struct NativeFontHandleWrapper<'a>(pub &'a NativeFontHandle);
--- a/gfx/webrender/src/render_task.rs
+++ b/gfx/webrender/src/render_task.rs
@@ -120,17 +120,17 @@ impl RenderTaskTree {
 
         let pass_index = if task.is_global_cached_task() {
             0
         } else {
             pass_index
         };
 
         let pass = &mut passes[pass_index];
-        pass.add_render_task(id, task.get_dynamic_size(), task.target_kind());
+        pass.add_render_task(id, task.get_dynamic_size(), task.target_kind(), &task.location);
     }
 
     pub fn prepare_for_render(&mut self) {
         for task in &mut self.tasks {
             task.prepare_for_render();
         }
     }
 
@@ -168,17 +168,17 @@ impl ops::Index<RenderTaskId> for Render
 impl ops::IndexMut<RenderTaskId> for RenderTaskTree {
     fn index_mut(&mut self, id: RenderTaskId) -> &mut RenderTask {
         debug_assert_eq!(self.frame_id, id.1);
         &mut self.tasks[id.0 as usize]
     }
 }
 
 /// Identifies the output buffer location for a given `RenderTask`.
-#[derive(Debug)]
+#[derive(Clone, Debug)]
 #[cfg_attr(feature = "capture", derive(Serialize))]
 #[cfg_attr(feature = "replay", derive(Deserialize))]
 pub enum RenderTaskLocation {
     /// The `RenderTask` should be drawn to a fixed region in a specific render
     /// target. This is used for the root `RenderTask`, where the main
     /// framebuffer is used as the render target.
     Fixed(DeviceIntRect),
     /// The `RenderTask` should be drawn to a target provided by the atlas
@@ -197,16 +197,26 @@ pub enum RenderTaskLocation {
         texture: CacheTextureId,
         /// The target layer in the above texture.
         layer: LayerIndex,
         /// The target region within the above layer.
         rect: DeviceIntRect,
     },
 }
 
+impl RenderTaskLocation {
+    /// Returns true if this is a dynamic location.
+    pub fn is_dynamic(&self) -> bool {
+        match *self {
+            RenderTaskLocation::Dynamic(..) => true,
+            _ => false,
+        }
+    }
+}
+
 #[derive(Debug)]
 #[cfg_attr(feature = "capture", derive(Serialize))]
 #[cfg_attr(feature = "replay", derive(Deserialize))]
 pub struct CacheMaskTask {
     actual_rect: DeviceIntRect,
     pub root_spatial_node_index: SpatialNodeIndex,
     pub clip_node_range: ClipNodeRange,
 }
--- a/gfx/webrender/src/tiling.rs
+++ b/gfx/webrender/src/tiling.rs
@@ -190,36 +190,37 @@ pub enum RenderTargetKind {
 ///
 /// Note that in some cases (like drop-shadows), we can depend on the output of
 /// a pass earlier than the immediately-preceding pass. See `SavedTargetIndex`.
 #[cfg_attr(feature = "capture", derive(Serialize))]
 #[cfg_attr(feature = "replay", derive(Deserialize))]
 pub struct RenderTargetList<T> {
     screen_size: DeviceIntSize,
     pub format: ImageFormat,
-    /// The maximum width and height of any single primitive we've encountered.
+    /// The maximum width and height of any single primitive we've encountered
+    /// that will be drawn to a dynamic location.
     ///
     /// We initially create our per-slice allocators with a width and height of
     /// IDEAL_MAX_TEXTURE_DIMENSION. If we encounter a larger primitive, the
-    /// allocation will fail, but we'll bump max_size, which will cause the
+    /// allocation will fail, but we'll bump max_dynamic_size, which will cause the
     /// allocator for the next slice to be just large enough to accomodate it.
-    pub max_size: DeviceUintSize,
+    pub max_dynamic_size: DeviceUintSize,
     pub targets: Vec<T>,
     pub saved_index: Option<SavedTargetIndex>,
 }
 
 impl<T: RenderTarget> RenderTargetList<T> {
     fn new(
         screen_size: DeviceIntSize,
         format: ImageFormat,
     ) -> Self {
         RenderTargetList {
             screen_size,
             format,
-            max_size: DeviceUintSize::new(0, 0),
+            max_dynamic_size: DeviceUintSize::new(0, 0),
             targets: Vec::new(),
             saved_index: None,
         }
     }
 
     fn build(
         &mut self,
         ctx: &mut RenderTargetContext,
@@ -278,18 +279,18 @@ impl<T: RenderTarget> RenderTargetList<T
 
         let origin = match existing_origin {
             Some(origin) => origin,
             None => {
                 // Have the allocator restrict slice sizes to our max ideal
                 // dimensions, unless we've already gone bigger on a previous
                 // slice.
                 let allocator_dimensions = DeviceUintSize::new(
-                    cmp::max(IDEAL_MAX_TEXTURE_DIMENSION, self.max_size.width),
-                    cmp::max(IDEAL_MAX_TEXTURE_DIMENSION, self.max_size.height),
+                    cmp::max(IDEAL_MAX_TEXTURE_DIMENSION, self.max_dynamic_size.width),
+                    cmp::max(IDEAL_MAX_TEXTURE_DIMENSION, self.max_dynamic_size.height),
                 );
                 let mut new_target = T::new(Some(allocator_dimensions), self.screen_size);
                 let origin = new_target.allocate(alloc_size).expect(&format!(
                     "Each render task must allocate <= size of one target! ({})",
                     alloc_size
                 ));
                 self.targets.push(new_target);
                 origin
@@ -300,18 +301,18 @@ impl<T: RenderTarget> RenderTargetList<T
     }
 
     pub fn needs_depth(&self) -> bool {
         self.targets.iter().any(|target| target.needs_depth())
     }
 
     pub fn check_ready(&self, t: &Texture) {
         let dimensions = t.get_dimensions();
-        assert!(dimensions.width >= self.max_size.width);
-        assert!(dimensions.height >= self.max_size.height);
+        assert!(dimensions.width >= self.max_dynamic_size.width);
+        assert!(dimensions.height >= self.max_dynamic_size.height);
         assert_eq!(t.get_format(), self.format);
         assert_eq!(t.get_layer_count() as usize, self.targets.len());
         assert!(t.supports_depth() >= self.needs_depth());
     }
 }
 
 /// Frame output information for a given pipeline ID.
 /// Storing the task ID allows the renderer to find
@@ -888,24 +889,31 @@ impl RenderPass {
     }
 
     /// Adds a task to this pass.
     pub fn add_render_task(
         &mut self,
         task_id: RenderTaskId,
         size: DeviceIntSize,
         target_kind: RenderTargetKind,
+        location: &RenderTaskLocation,
     ) {
         if let RenderPassKind::OffScreen { ref mut color, ref mut alpha, .. } = self.kind {
-            let max_size = match target_kind {
-                RenderTargetKind::Color => &mut color.max_size,
-                RenderTargetKind::Alpha => &mut alpha.max_size,
-            };
-            max_size.width = cmp::max(max_size.width, size.width as u32);
-            max_size.height = cmp::max(max_size.height, size.height as u32);
+            // If this will be rendered to a dynamically-allocated region on an
+            // off-screen render target, update the max-encountered size. We don't
+            // need to do this for things drawn to the texture cache, since those
+            // don't affect our render target allocation.
+            if location.is_dynamic() {
+                let max_size = match target_kind {
+                    RenderTargetKind::Color => &mut color.max_dynamic_size,
+                    RenderTargetKind::Alpha => &mut alpha.max_dynamic_size,
+                };
+                max_size.width = cmp::max(max_size.width, size.width as u32);
+                max_size.height = cmp::max(max_size.height, size.height as u32);
+            }
         }
 
         self.tasks.push(task_id);
     }
 
     /// Processes this pass to prepare it for rendering.
     ///
     /// Among other things, this allocates output regions for each of our tasks
--- a/gfx/webrender_bindings/revision.txt
+++ b/gfx/webrender_bindings/revision.txt
@@ -1,1 +1,1 @@
-e7d340b0f39bbd0046e983a75245bdde54013cdb
+b5463c2074813237098804f4f0219cf1ba6c6984