Creating 2D texture array

Started by
1 comment, last by Ryan_001 10 years, 8 months ago

Simple question. I need to create a 2D array texture with mipmaps. I'd like it to be immutable. I'm not sure how to set up my D3D11_SUBRESOURCE_DATA structures. How many do I need and in what order?

Advertisement
You need one per subresource in your texture, which means you will have ArraySize * MipLevels subresources. For the ordering you pass the data for Mip 0 of Index 0, then Mip 1 of Index 0, and so on for all Mip levels. Then you go to Mip 0 of Index 1, then Mip 1, and so on for all array slices. You can calculate the subresource index by doing ArrayIndex * NumMips + MipLevel.

Also just so you know, the DirectXTex package has a command-line tool called Texassembler that can pack a bunch of textures into a texture array and save it as DDS format, which can be convenient.

Thank-you much appreciated ;)

This topic is closed to new replies.

Advertisement