I’ve already finished someting like this for texturecube however right here I do not perceive what I am doing unsuitable. I’ve the primary probability exception error message.
Beneath how I proceed:
- create a texture for depthstencil as texture2Darray (arraysize = 3). works wonderful
- create a depthstencilarray from this texture. works wonderful
now I wish to create an array of depthstencil to have the ability to render to them individually and not using a geometry shader
so I substitute 2) like this
2)
ID3D11DepthStencilView* CreateDepthStencilView2DFromArray(ID3D11Texture2D* pText2D, DXGI_FORMAT Format, DWORD Slice)//slice is the index to make use of within the array
{
ID3D11DepthStencilView* pDSV = NULL;
D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
ZeroMemory(&descDSV, sizeof(descDSV));
descDSV.Format = Format;
descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
descDSV.Texture2DArray.FirstArraySlice = Slice;
descDSV.Texture2DArray.ArraySize = 1;
descDSV.Texture2DArray.MipSlice = 0;
HRESULT hr = gpD11->CreateDepthStencilView(pText2D, &descDSV, &pDSV);
if (FAILED(hr)) return NULL;
return pDSV;
}
of be aware I do not use mipmaps so I set MipSlice to 0.