Skip to content

Commit

Permalink
[D3D] Check for MSAA attachment creation failure.
Browse files Browse the repository at this point in the history
In some cases the MSAA texture allocation can fail when setting up a
GrD3DTextureRenderTarget, so we need to check for this and
return nullptr.

Change-Id: I9f0afa1357032eb8dd6829f4cdfdb14ca466bafc
Bug: skia:14237
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/667300
Commit-Queue: James Godfrey-Kittle <[email protected]>
Auto-Submit: Jim Van Verth <[email protected]>
Reviewed-by: James Godfrey-Kittle <[email protected]>
  • Loading branch information
jvanverth authored and SkCQ committed Apr 7, 2023
1 parent dfd8c8c commit 01b831c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ sk_sp<GrD3DTextureRenderTarget> GrD3DTextureRenderTarget::MakeNewTextureRenderTa
SkColor4f clearColor = { 0, 0, 0, 0 };
std::tie(msInfo, msState) =
GrD3DTextureResource::CreateMSAA(gpu, dimensions, sampleCnt, info, clearColor);
if (!msInfo.fResource || !msState) {
return nullptr;
}

const GrD3DDescriptorHeap::CPUHandle msaaRenderTargetView =
gpu->resourceProvider().createRenderTargetView(msInfo.fResource.get());
Expand Down Expand Up @@ -201,6 +204,9 @@ sk_sp<GrD3DTextureRenderTarget> GrD3DTextureRenderTarget::MakeWrappedTextureRend
SkColor4f clearColor = { 1, 1, 1, 1 };
std::tie(msInfo, msState) =
GrD3DTextureResource::CreateMSAA(gpu, dimensions, sampleCnt, info, clearColor);
if (!msInfo.fResource || !msState) {
return nullptr;
}

const GrD3DDescriptorHeap::CPUHandle msaaRenderTargetView =
gpu->resourceProvider().createRenderTargetView(msInfo.fResource.get());
Expand Down

0 comments on commit 01b831c

Please sign in to comment.