1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d10] Fix crash in CreateDepthStencilView when pDesc is null

This is legal and we should just pass the null pointer to D3D11.
Should fix a crash in Stalker: Call of Pripyat.
This commit is contained in:
Philip Rebohle 2018-08-14 00:12:53 +02:00
parent 861165f32a
commit dad015bd67
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -287,7 +287,11 @@ namespace dxvk {
Com<ID3D11Resource> d3d11Resource;
GetD3D11Resource(pResource, &d3d11Resource);
// D3D10 doesn't have the Flags member, so we have
// to convert the structure. pDesc can be nullptr.
D3D11_DEPTH_STENCIL_VIEW_DESC d3d11Desc;
if (pDesc != nullptr) {
d3d11Desc.ViewDimension = D3D11_DSV_DIMENSION(pDesc->ViewDimension);
d3d11Desc.Format = pDesc->Format;
d3d11Desc.Flags = 0;
@ -324,10 +328,11 @@ namespace dxvk {
d3d11Desc.Texture2DMSArray.ArraySize = pDesc->Texture2DMSArray.ArraySize;
break;
}
}
ID3D11DepthStencilView* d3d11View = nullptr;
HRESULT hr = m_device->CreateDepthStencilView(
d3d11Resource.ptr(), &d3d11Desc,
d3d11Resource.ptr(), pDesc ? &d3d11Desc : nullptr,
ppDepthStencilView ? &d3d11View : nullptr);
if (FAILED(hr))