Bug 1718329 - Gracefully handle device reset when mapping tiles with SW-WR + D3D11 compositing. r=jrmuizel

If we encounter a device reset in
RenderCompositorD3D11SWGL::TileD3D11::Map, we should fail the call, and
rely upon the device reset checks at the end of a render pass to
recreate our compositor sessions.

Differential Revision: https://phabricator.services.mozilla.com/D121251
This commit is contained in:
Andrew Osmond 2021-07-29 22:45:41 +00:00
Родитель 6fda0f10ac
Коммит 2a4132a521
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -297,13 +297,15 @@ bool RenderCompositorD3D11SWGL::TileD3D11::Map(wr::DeviceIntRect aDirtyRect,
} }
hr = context->Map(mRenderCompositor->mCurrentStagingTexture, 0, hr = context->Map(mRenderCompositor->mCurrentStagingTexture, 0,
D3D11_MAP_READ_WRITE, 0, &mappedSubresource); D3D11_MAP_READ_WRITE, 0, &mappedSubresource);
MOZ_RELEASE_ASSERT(SUCCEEDED(hr));
} }
} }
if (!SUCCEEDED(hr)) { if (!SUCCEEDED(hr)) {
gfxCriticalError() << "Failed to map tile: " << gfx::hexa(hr); gfxCriticalError() << "Failed to map tile: " << gfx::hexa(hr);
// This is only expected to fail if we hit a device reset.
MOZ_RELEASE_ASSERT(
mRenderCompositor->GetDevice()->GetDeviceRemovedReason() != S_OK);
return false;
} }
MOZ_RELEASE_ASSERT(SUCCEEDED(hr));
// aData is expected to contain a pointer to the first pixel within the valid // aData is expected to contain a pointer to the first pixel within the valid
// rect, so take the mapped resource's data (which covers the full tile size) // rect, so take the mapped resource's data (which covers the full tile size)