[d3d11] Don't create SRVs and UAVs with a size of 0

This is illegal and triggers invalid Vulkan usage.
This commit is contained in:
Philip Rebohle 2019-06-13 03:47:10 +02:00
parent 4ffddd1e40
commit f02a5a7453
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 15 additions and 0 deletions

View File

@ -371,6 +371,16 @@ namespace dxvk {
pDesc->Format = format;
switch (pDesc->ViewDimension) {
case D3D11_SRV_DIMENSION_BUFFER:
if (pDesc->Buffer.NumElements == 0)
return E_INVALIDARG;
break;
case D3D11_SRV_DIMENSION_BUFFEREX:
if (pDesc->BufferEx.NumElements == 0)
return E_INVALIDARG;
break;
case D3D11_SRV_DIMENSION_TEXTURE1D:
if (pDesc->Texture1D.MipLevels > mipLevels - pDesc->Texture1D.MostDetailedMip)
pDesc->Texture1D.MipLevels = mipLevels - pDesc->Texture1D.MostDetailedMip;

View File

@ -286,6 +286,11 @@ namespace dxvk {
pDesc->Format = format;
switch (pDesc->ViewDimension) {
case D3D11_UAV_DIMENSION_BUFFER:
if (pDesc->Buffer.NumElements == 0)
return E_INVALIDARG;
break;
case D3D11_UAV_DIMENSION_TEXTURE1DARRAY:
if (pDesc->Texture1DArray.ArraySize > numLayers - pDesc->Texture1DArray.FirstArraySlice)
pDesc->Texture1DArray.ArraySize = numLayers - pDesc->Texture1DArray.FirstArraySlice;