Bug 1297105 - Prevent crash when DX11 resources fail to be allocated for Oculus VR HMD presentation
MozReview-Commit-ID: 3KLGu3DJVbP
--- 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);