简体   繁体   English

DirectX 11将多个纹理加载到Texture2DArray中

[英]DirectX 11 Loading multiple textures into Texture2DArray

Is there a way of taking an array of ID3D11Texture2D* objects and putting them together in a single ID3D11Texture2D* (with an appropriate ArraySize value) that will allow me to use a Texture2DArray in HLSL with them? 有没有办法获取ID3D11Texture2D *对象的数组并将它们放到单个ID3D11Texture2D *(具有适当的ArraySize值)中,从而使我可以在HLSL中与它们一起使用Texture2DArray?

At the very least, how do you pass in the individual textures when creating a new ID3D11Texture2D object after you have set ArraySize to greater than 1? 至少,将ArraySize设置为大于1后,如何在创建新的ID3D11Texture2D对象时传递各个纹理? Do you need to pass in an array of SUBRESOURCE_DATA structs with each pointing to a texture to the CreateTexture2D function? 您是否需要传递一个SUBRESOURCE_DATA结构数组,每个结构均指向CreateTexture2D函数的纹理? I've been looking around for an answer to this, but the documentation seems severely lacking. 我一直在寻找答案,但是似乎严重缺乏该文档。

Thanks for any help you can provide. 感谢您的任何帮助,您可以提供。

To copy existing textures to a texture array, you can use CopySubresourceRegion using the destination subresource index described below. 要将现有纹理复制到纹理数组,可以使用CopySubresourceRegion ,该对象使用下面描述的目标子资源索引。

To create a new texture array with initial data, you specify multiple subresources (array slices / mip levels) using an array of SUBRESOURCE_DATA structures. 要使用初始数据创建新的纹理数组,请使用SUBRESOURCE_DATA结构数组指定多个子资源(数组切片/ mip级别)。 Subresource index is defined as mip slice + array slice * mip leves . 子资源索引定义为mip slice + array slice * mip leves So for a 2-slice 3-MIP texture array, you would have the following subresources: 因此,对于2切片3-MIP纹理数组,您将具有以下子资源:

[0]: slice 0 mip 0
[1]: slice 0 mip 1
[2]: slice 0 mip 2
[3]: slice 1 mip 0
[4]: slice 1 mip 1
[5]: slice 1 mip 2

This is described in more detail at the following page: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476901(v=vs.85).aspx . 在下面的页面中对此进行了更详细的描述: http : //msdn.microsoft.com/zh-cn/library/windows/desktop/ff476901(v=vs.85).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM