Bug 1116812 - Consider DXGI_ERROR_INVALID_CALL a recoverable error for IDXGISwapChain::GetBuffer. r=jrmuizel, a=sledru

This commit is contained in:
Bas Schouten
2015-04-29 09:19:00 -04:00
parent fc2b1ccefc
commit 0feeadb17f

View File

@@ -1049,7 +1049,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
// this is important because resizing our buffers when mimised will fail and // this is important because resizing our buffers when mimised will fail and
// cause a crash when we're restored. // cause a crash when we're restored.
NS_ASSERTION(mHwnd, "Couldn't find an HWND when initialising?"); 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(); *aRenderBoundsOut = Rect();
return; return;
} }
@@ -1122,6 +1122,10 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
void void
CompositorD3D11::EndFrame() CompositorD3D11::EndFrame()
{ {
if (!mDefaultRT) {
return;
}
mContext->Flush(); mContext->Flush();
nsIntSize oldSize = mSize; nsIntSize oldSize = mSize;
@@ -1262,6 +1266,13 @@ CompositorD3D11::UpdateRenderTarget()
nsRefPtr<ID3D11Texture2D> backBuf; nsRefPtr<ID3D11Texture2D> backBuf;
hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment()); 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)) { if (Failed(hr)) {
return; return;
} }