Bug 1543356 - Visual glitches on resizing the browser with WebRender. r=emilio
authorGlenn Watson <github@intuitionlibrary.com>
Thu, 18 Apr 2019 15:28:39 +0000
changeset 470139 b03a3303ad6e4be3f61f597dce9b1d875c0ebd04
parent 470138 22c00a19e267d91446352bff4d39d70a1280b20c
child 470140 5a890f8d88d5f45309ba1fc54e0ad610f72b6948
push id112843
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:50:22 +0000
treeherdermozilla-inbound@c06f27cbfe40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1543356
milestone68.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 1543356 - Visual glitches on resizing the browser with WebRender. r=emilio 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
@@ -4633,16 +4633,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));