Bug 1297105 - Prevent crash when DX11 resources fail to be allocated for Oculus VR HMD presentation r=mccr8
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Tue, 30 Aug 2016 15:34:11 -0700
changeset 312504 a3c6df384b47f6e2c92ecbc4b494fc2323e8fbd3
parent 312503 2625be475f1dd70ccf8303388f71d749fd9f8631
child 312505 97471e6c4d4c67339d3896f7df36b02e1d570105
push id30645
push userryanvm@gmail.com
push dateSat, 03 Sep 2016 15:18:20 +0000
treeherdermozilla-central@c6906f5fc278 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1297105
milestone51.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 1297105 - Prevent crash when DX11 resources fail to be allocated for Oculus VR HMD presentation r=mccr8 MozReview-Commit-ID: 3KLGu3DJVbP
gfx/vr/gfxVROculus.cpp
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -753,16 +753,27 @@ VRDisplayOculus::SubmitFrame(TextureSour
   const IntSize& aSize,
   const VRHMDSensorState& aSensorState,
   const gfx::Rect& aLeftEyeRect,
   const gfx::Rect& aRightEyeRect)
 {
   if (!mIsPresenting) {
     return;
   }
+  if (mRenderTargets.IsEmpty()) {
+    /**
+     * XXX - We should resolve fail the promise returned by
+     *       VRDisplay.requestPresent() when the DX11 resources fail allocation
+     *       in VRDisplayOculus::StartPresentation().
+     *       Bailing out here prevents the crash but content should be aware
+     *       that frames are not being presented.
+     *       See Bug 1299309.
+     **/
+    return;
+  }
   MOZ_ASSERT(mDevice);
   MOZ_ASSERT(mContext);
 
   RefPtr<CompositingRenderTargetD3D11> surface = GetNextRenderTarget();
 
   surface->BindRenderTarget(mContext);
 
   Matrix viewMatrix = Matrix::Translation(-1.0, 1.0);