1
\$\begingroup\$

I'm trying to implement depth peeling onto a 2D texture array, where each array slice corresponds to a depth layer. In order to do this, I'd like to draw to subsequent array slices of this texture, while using the previous slice for depth testing.

This seems impossible without copying subresources in between each draw, which I'd like to not do. I found this question, where the answer suggests using the MipSlice parameter to access the array slice. This seems like a mistake, as the subresources guide states clearly that mip slices select the miplevel for each array slice. I'd guess that in the case of mismatching texture types, like using a single array slice as its own resource, this would select the miplevel of that array slice. But it doesn't make sense to use the mip slice to access the entire resource as if by subresource index.

Even if you can do this, would the API know how far to increment the pointer into the GPU resource? Shouldn't incrementing the mip slice be telling the API to increment the pointer by less, to account for the smaller size (each mipslice has dimensions half that of the previous)?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I think the docs are a bit ambiguous - however;

https://learn.microsoft.com/en-us/windows/win32/api/d3d11/ns-d3d11-d3d11_tex2d_rtv

The Texture2D part of the RTV Description "Specifies the subresource from a 2D texture to use in a render-target view." and the mipSlice property "The index of the mipmap level to use mip slice."

The Subresources Guide tells you what the value of mipSlice should be in a TextureArray - a combination of mip level and array index obtained from CalcSubresource().

A texture array or texture containing mips, is a collection of subresources. I think the RTV mipSlice property would be better called "subresourceID" - but it works for me.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .