Bug 1543356 - Visual glitches on resizing the browser with WebRender. r=emilio a=RyanVM
authorGlenn Watson <github@intuitionlibrary.com>
Thu, 18 Apr 2019 15:28:39 +0000
changeset 526271 50707a995cd56232e52b0e3453ec73c17e1339e6
parent 526270 5e9f1cf0693663467059f729d897e2f23b4631e9
child 526272 b196e0c2e6a883a027266d6d11d647e9ef259599
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, RyanVM
bugs1543356
milestone67.0
Bug 1543356 - Visual glitches on resizing the browser with WebRender. r=emilio a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D27978
gfx/wr/webrender/src/renderer.rs
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -4292,16 +4292,35 @@ impl Renderer {
     ) {
         let _gm = self.gpu_profile.start_marker("tile frame draw");
 
         if frame.passes.is_empty() {
             frame.has_been_rendered = true;
             return;
         }
 
+        // TODO(gw): This is a hack / workaround for a resizing glitch. What
+        //           happens is that the framebuffer rect / content origin are
+        //           determined during frame building, rather than at render
+        //           time (which is what used to happen). This means that the
+        //           framebuffer rect/origin can be wrong by the time a frame
+        //           is drawn, if resizing is occurring. This hack just makes
+        //           the framebuffer rect/origin be hard coded to the current
+        //           framebuffer size at render time. It seems like this probably
+        //           breaks some assumptions elsewhere, but it seems to fix the
+        //           bug and I haven't noticed any other issues so far. We will
+        //           need to investigate this further and make a "proper" fix.
+        if let Some(framebuffer_size) = framebuffer_size {
+            frame.framebuffer_rect = FramebufferIntRect::new(
+                FramebufferIntPoint::zero(),
+                framebuffer_size,
+            );
+            frame.content_origin = DeviceIntPoint::zero();
+        }
+
         self.device.disable_depth_write();
         self.set_blend(false, FramebufferKind::Other);
         self.device.disable_stencil();
 
         self.bind_frame_data(frame);
 
         for (pass_index, pass) in frame.passes.iter_mut().enumerate() {
             let _gm = self.gpu_profile.start_marker(&format!("pass {}", pass_index));