Bug 1613712 - Pass a correct compositorConnection instead of null ptr in the GLScreenBuffer::CreateFactory call used to ensure that a not added to DOM canvas is ready for VR. r=jgilbert
authorImanol Fernandez <mortimergoro@gmail.com>
Fri, 07 Feb 2020 01:52:43 +0000
changeset 512879 5e1fdd4ae2ff964d58f1df10b9a09f752b3b205c
parent 512878 743fb8cbcce42a5079b2b41120a5c47faa175582
child 512880 019a06257bf82ea120917c34d6ca3b564345bd25
push id106687
push userigorostizaga@mozilla.com
push dateFri, 07 Feb 2020 09:42:48 +0000
treeherderautoland@5e1fdd4ae2ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1613712
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 1613712 - Pass a correct compositorConnection instead of null ptr in the GLScreenBuffer::CreateFactory call used to ensure that a not added to DOM canvas is ready for VR. r=jgilbert Fix regression from the WebGL remoting client/host refactor. Differential Revision: https://phabricator.services.mozilla.com/D61878
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -1753,17 +1753,23 @@ void WebGLContext::EnsureVRReady() {
   // compositor renders a WebGL canvas for the first time. This causes canvases
   // not added to the DOM not to work properly with WebVR. Here we mimic what
   // InitializeCanvasRenderer does internally as a workaround.
   const auto caps = gl->Screen()->mCaps;
   auto flags = layers::TextureFlags::ORIGIN_BOTTOM_LEFT;
   if (!IsPremultAlpha() && mOptions.alpha) {
     flags |= layers::TextureFlags::NON_PREMULTIPLIED;
   }
-  auto factory = gl::GLScreenBuffer::CreateFactory(gl, caps, nullptr, flags);
+  RefPtr<layers::ImageBridgeChild> imageBridge =
+      layers::ImageBridgeChild::GetSingleton();
+  if (!imageBridge) {
+    return;
+  }
+  auto factory =
+      gl::GLScreenBuffer::CreateFactory(gl, caps, imageBridge.get(), flags);
   gl->Screen()->Morph(std::move(factory));
 
   bool needsResize = false;
 #if defined(MOZ_WIDGET_ANDROID)
   // On Android we are using a different GLScreenBuffer for WebVR, so we need
   // a resize here because PresentScreenBuffer() may not be called for the
   // gl->Screen() after we set the new factory.
   needsResize = true;