Bug 1696325 - Handle StagingTexture allocation failure in RenderCompositorD3D11SWGL r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D107176
This commit is contained in:
@@ -236,6 +236,10 @@ bool RenderCompositorD3D11SWGL::TileD3D11::Map(wr::DeviceIntRect aDirtyRect,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mRenderCompositor->mCurrentStagingTexture) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ID3D11DeviceContext> context;
|
||||
mRenderCompositor->GetDevice()->GetImmediateContext(getter_AddRefs(context));
|
||||
|
||||
@@ -277,6 +281,9 @@ bool RenderCompositorD3D11SWGL::TileD3D11::Map(wr::DeviceIntRect aDirtyRect,
|
||||
if (hr == DXGI_ERROR_WAS_STILL_DRAWING) {
|
||||
mRenderCompositor->mCurrentStagingTexture =
|
||||
mRenderCompositor->CreateStagingTexture(tileSize);
|
||||
if (!mRenderCompositor->mCurrentStagingTexture) {
|
||||
return false;
|
||||
}
|
||||
hr = context->Map(mRenderCompositor->mCurrentStagingTexture, 0,
|
||||
D3D11_MAP_READ_WRITE, 0, &mappedSubresource);
|
||||
}
|
||||
@@ -319,6 +326,10 @@ void RenderCompositorD3D11SWGL::TileD3D11::Unmap(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mRenderCompositor->mCurrentStagingTexture) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<ID3D11DeviceContext> context;
|
||||
mRenderCompositor->GetDevice()->GetImmediateContext(getter_AddRefs(context));
|
||||
|
||||
@@ -366,6 +377,9 @@ RenderCompositorD3D11SWGL::CreateStagingTexture(const gfx::IntSize aSize) {
|
||||
DebugOnly<HRESULT> hr =
|
||||
GetDevice()->CreateTexture2D(&desc, nullptr, getter_AddRefs(cpuTexture));
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
if (!cpuTexture) {
|
||||
gfxCriticalNote << "Failed to create StagingTexture: " << aSize;
|
||||
}
|
||||
return cpuTexture.forget();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user