1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d11] Handle pResource == nullptr case during view creation

This commit is contained in:
Philip Rebohle 2018-09-19 11:55:11 +02:00
parent 837a3f5787
commit c1190e81b2
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -282,6 +282,9 @@ namespace dxvk {
ID3D11ShaderResourceView** ppSRView) {
InitReturnPtr(ppSRView);
if (pResource == nullptr)
return E_INVALIDARG;
D3D11_COMMON_RESOURCE_DESC resourceDesc;
GetCommonResourceDesc(pResource, &resourceDesc);
@ -327,6 +330,9 @@ namespace dxvk {
ID3D11UnorderedAccessView** ppUAView) {
InitReturnPtr(ppUAView);
if (pResource == nullptr)
return E_INVALIDARG;
D3D11_COMMON_RESOURCE_DESC resourceDesc;
GetCommonResourceDesc(pResource, &resourceDesc);
@ -371,19 +377,19 @@ namespace dxvk {
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView) {
InitReturnPtr(ppRTView);
if (pResource == nullptr)
return E_INVALIDARG;
// DXVK only supports render target views for image resources
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
D3D11_COMMON_RESOURCE_DESC resourceDesc;
GetCommonResourceDesc(pResource, &resourceDesc);
if (resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) {
if (resourceDesc.Dim == D3D11_RESOURCE_DIMENSION_BUFFER) {
Logger::warn("D3D11: Cannot create render target view for a buffer");
return S_OK; // It is required to run Battlefield 3 and Battlefield 4.
}
D3D11_COMMON_RESOURCE_DESC resourceDesc;
GetCommonResourceDesc(pResource, &resourceDesc);
// The view description is optional. If not defined, it
// will use the resource's format and all array layers.
D3D11_RENDER_TARGET_VIEW_DESC desc;
@ -426,6 +432,9 @@ namespace dxvk {
ID3D11DepthStencilView** ppDepthStencilView) {
InitReturnPtr(ppDepthStencilView);
if (pResource == nullptr)
return E_INVALIDARG;
D3D11_COMMON_RESOURCE_DESC resourceDesc;
GetCommonResourceDesc(pResource, &resourceDesc);