Bug 1613316 - Fix panic in TileCache::pre_update. r=Bert
authorGlenn Watson <gw@intuitionlibrary.com>
Thu, 06 Feb 2020 21:44:44 +0000
changeset 512819 f1568adc54fd89d2cdc0ac4ff1e586272bcf07be
parent 512818 3a02cc6f98eab83cdb48c8e5344d9b8b46050808
child 512820 ac19d46c04f904d124df1e3dbfc966d9f6022642
push id37098
push usercsabou@mozilla.com
push dateFri, 07 Feb 2020 03:55:51 +0000
treeherdermozilla-central@7dcafc398876 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBert
bugs1613316
milestone74.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 1613316 - Fix panic in TileCache::pre_update. r=Bert Differential Revision: https://phabricator.services.mozilla.com/D61922
gfx/wr/webrender/src/picture.rs
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -821,17 +821,29 @@ impl Tile {
     /// Called during pre_update of a tile cache instance. Allows the
     /// tile to setup state before primitive dependency calculations.
     fn pre_update(
         &mut self,
         local_tile_rect: PictureRect,
         ctx: &TilePreUpdateContext,
     ) {
         self.local_tile_rect = local_tile_rect;
-        self.local_valid_rect = local_tile_rect.intersection(&ctx.local_rect).unwrap();
+        // TODO(gw): In theory, the local tile rect should always have an
+        //           intersection with the overall picture rect. In practice,
+        //           due to some accuracy issues with how fract_offset (and
+        //           fp accuracy) are used in the calling method, this isn't
+        //           always true. In this case, it's safe to set the local
+        //           valid rect to zero, which means it will be clipped out
+        //           and not affect the scene. In future, we should fix the
+        //           accuracy issue above, so that this assumption holds, but
+        //           it shouldn't have any noticeable effect on performance
+        //           or memory usage (textures should never get allocated).
+        self.local_valid_rect = local_tile_rect
+            .intersection(&ctx.local_rect)
+            .unwrap_or_else(PictureRect::zero);
         self.invalidation_reason  = None;
 
         self.world_tile_rect = ctx.pic_to_world_mapper
             .map(&self.local_tile_rect)
             .expect("bug: map local tile rect");
 
         self.world_valid_rect = ctx.pic_to_world_mapper
             .map(&self.local_valid_rect)