1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 22:24:15 +01:00

[d3d11] Added experimental support for RTVs into 3D images

This commit is contained in:
Philip Rebohle 2018-02-14 03:16:53 +01:00
parent 7bbb6ea93b
commit fba16e2a04
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -496,11 +496,6 @@ namespace dxvk {
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
if (resourceDim != D3D11_RESOURCE_DIMENSION_TEXTURE2D) {
Logger::err("D3D11: Unsupported resource type for render target views");
return E_INVALIDARG;
}
// 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;
@ -557,6 +552,14 @@ namespace dxvk {
viewInfo.numLayers = desc.Texture2DMSArray.ArraySize;
break;
case D3D11_RTV_DIMENSION_TEXTURE3D:
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
viewInfo.minLevel = desc.Texture3D.MipSlice;
viewInfo.numLevels = 1;
viewInfo.minLayer = desc.Texture3D.FirstWSlice;
viewInfo.numLayers = desc.Texture3D.WSize;
break;
default:
Logger::err(str::format(
"D3D11: pDesc->ViewDimension not supported for render target views: ",
@ -589,11 +592,6 @@ namespace dxvk {
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
if (resourceDim != D3D11_RESOURCE_DIMENSION_TEXTURE2D) {
Logger::err("D3D11: Unsupported resource type for depth-stencil views");
return E_INVALIDARG;
}
// The view description is optional. If not defined, it
// will use the resource's format and all array layers.
D3D11_DEPTH_STENCIL_VIEW_DESC desc;
@ -1740,6 +1738,17 @@ namespace dxvk {
}
} return S_OK;
case D3D11_RESOURCE_DIMENSION_TEXTURE3D: {
D3D11_TEXTURE3D_DESC resourceDesc;
static_cast<D3D11Texture3D*>(pResource)->GetDesc(&resourceDesc);
pDesc->Format = resourceDesc.Format;
pDesc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
pDesc->Texture3D.MipSlice = 0;
pDesc->Texture3D.FirstWSlice = 0;
pDesc->Texture3D.WSize = resourceDesc.Depth;
} return S_OK;
default:
Logger::err(str::format(
"D3D11: Unsupported dimension for render target view: ",
@ -2068,7 +2077,7 @@ namespace dxvk {
}
format = resourceDesc.Format;
numLayers = 1;
numLayers = resourceDesc.Depth;
} break;
default:
@ -2094,6 +2103,11 @@ namespace dxvk {
pDesc->Texture2DMSArray.ArraySize = numLayers - pDesc->Texture2DMSArray.FirstArraySlice;
break;
case D3D11_RTV_DIMENSION_TEXTURE3D:
if (pDesc->Texture3D.WSize == D3D11_DXVK_USE_REMAINING_LAYERS)
pDesc->Texture3D.WSize = numLayers - pDesc->Texture3D.FirstWSlice;
break;
default:
break;
}