Search code examples
c++directxdirectx-11direct3ddirect3d11

Is there a way to Render into a different array index of a depth map in direct 3d 11


Recently, I was implementing cascaded shadow mapping with direct 3d 11, I used an array texture to store the different shadow maps for each light source. I also configured the depth map to be an array texture, but I can't seem to find out how to store depth in the other textures in the array.

I tried using a Geometry Shader and setting the SV_RenderTargetArrayIndex to 1 or 2, but I guess that only works for render target views and not depth stencil views.

I am just wondering if it's possible to do this without having to create 3 depth-Stencil Views for each texture in the array.

Edit: my mistake was not calling restartstrip after setting the positions.


Solution

  • From the documentation for System Value semantics in D3D11, in the SV_RenderTargetArrayIndex table row:

    This value also indicates which array slice of a depth/stencil view is used for read/write purposes.

    So the SV_RenderTargetArrayIndex semantic is the correct one to use for rendering to the different indices in the depth/stencil array.