diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 52d9898850d4..5e227852f203 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1049,7 +1049,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, // this is important because resizing our buffers when mimised will fail and // cause a crash when we're restored. NS_ASSERTION(mHwnd, "Couldn't find an HWND when initialising?"); - if (::IsIconic(mHwnd) || gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) { + if (::IsIconic(mHwnd) || mDevice->GetDeviceRemovedReason() != S_OK) { *aRenderBoundsOut = Rect(); return; } @@ -1122,6 +1122,10 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, void CompositorD3D11::EndFrame() { + if (!mDefaultRT) { + return; + } + mContext->Flush(); nsIntSize oldSize = mSize; @@ -1262,6 +1266,13 @@ CompositorD3D11::UpdateRenderTarget() nsRefPtr backBuf; hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment()); + if (hr == DXGI_ERROR_INVALID_CALL) { + // This happens on some GPUs/drivers when there's a TDR. + if (mDevice->GetDeviceRemovedReason() != S_OK) { + gfxCriticalError() << "GetBuffer returned invalid call!"; + return; + } + } if (Failed(hr)) { return; }