Add checks on D3D11 resource discard that we have a valid view/resource

This commit is contained in:
baldurk
2021-03-01 10:41:40 +00:00
parent 7171350638
commit 839665f3ca
+16 -1
View File
@@ -753,11 +753,16 @@ void D3D11DebugManager::FillWithDiscardPattern(DiscardType type, ID3D11Resource
for(UINT z = 0; z < RDCMAX(1U, desc.Depth >> subresource); z++)
FillWithDiscardPattern(type, res, z, subresource, pRect, NumRects);
}
else
else if(WrappedID3D11Buffer::IsAlloc(res))
{
// buffer
FillWithDiscardPattern(type, res, 0, 0, pRect, NumRects);
}
else
{
RDCERR("Unknown resource type being discarded");
return;
}
}
void D3D11DebugManager::FillWithDiscardPattern(DiscardType type, ID3D11View *view,
@@ -784,6 +789,11 @@ void D3D11DebugManager::FillWithDiscardPattern(DiscardType type, ID3D11View *vie
{
range = ResourceRange((WrappedID3D11DepthStencilView *)view);
}
else
{
RDCERR("Unknown view type being discarded");
return;
}
ID3D11Resource *res = range.GetResource();
UINT numMips = 1;
@@ -810,6 +820,11 @@ void D3D11DebugManager::FillWithDiscardPattern(DiscardType type, ID3D11View *vie
numMips = desc.MipLevels;
tex3D = true;
}
else
{
RDCERR("View of unknown resource type being discarded");
return;
}
rdcarray<D3D11_RECT> rects;
rects.assign(pRect, NumRects);