From acf609f3d9ad34f5554d0fcea957c6047c08e688 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Wed, 15 Jan 2020 21:18:00 +0000 Subject: [PATCH] Bug 1608500 - Set SurfaceTexture factory into the VR GLScreenBuffer. r=jgilbert The VR ScreenBuffer is created with the default SurfaceFactory_Basic. We need to morph the screen to use the correct SurfaceTexture factory. Differential Revision: https://phabricator.services.mozilla.com/D60007 --HG-- extra : moz-landing-system : lando --- dom/canvas/WebGLContext.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 74d2f39dd3a4..ba46f8b6555a 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -1698,6 +1698,15 @@ RefPtr WebGLContext::GetVRFrame() { if (!vrScreen) { auto caps = gl->Screen()->mCaps; vrScreen = gl::GLScreenBuffer::Create(gl, gfx::IntSize(1, 1), caps); + RefPtr imageBridge = + layers::ImageBridgeChild::GetSingleton(); + if (imageBridge) { + layers::TextureFlags flags = layers::TextureFlags::ORIGIN_BOTTOM_LEFT; + UniquePtr factory = + gl::GLScreenBuffer::CreateFactory(gl, caps, imageBridge.get(), + flags); + vrScreen->Morph(std::move(factory)); + } } MOZ_ASSERT(vrScreen); @@ -1807,7 +1816,8 @@ bool ClientWebGLContext::IsXRCompatible() const { return options.xrCompatible; } -already_AddRefed ClientWebGLContext::MakeXRCompatible(ErrorResult& aRv) { +already_AddRefed ClientWebGLContext::MakeXRCompatible( + ErrorResult& aRv) { const FuncScope funcScope(*this, "MakeXRCompatible"); nsCOMPtr global; // TODO: Bug 1596921