Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

how do i load ID3D10ShaderResourceView* into texture2darray

This topic is 2463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i can send over ID3D10ShaderResourceView files to texture2d in the shader

but i need to send over an array of them to texture2dArray in the shader


i can send them over to a texture2d[100]; but this will not allow me to do the thing i want

Share this post


Link to post
Share on other sites
Advertisement
You need to create the associated Texture2D resource as a Texture2D array resource, and then create a shader resource view for that resource. If you're using D3DX helper functions the easiest thing to do is this:

1. Load all of the textures using D3DX10CreateTextureFromFile, with a D3DX10_IMAGE_LOAD_INFO specifying that you want D3D10_USAGE_STAGING. Note that all of your textures need to be the same size, have the same format, and have the same number of mip levels
2. Map every mip level of every texture
3. Set up an array of D3D10_SUBRESOURCE_DATA's with number of elements == number of textures * number of mip levels.
4. For each texture, set the pSysMem member of a D3D10_SUBRESOURCE_DATA to the pointer you got when you mapped each mip level of each texture. Make sure you also set the SysMemPitch to the pitch you got when you mapped that mip level
5. Call CreateTexture2D with the desired array size, and pass the array of D3D10_SUBRESOURCE_DATA's
6. Create a shader resource view for the texture

Share this post


Link to post
Share on other sites

You need to create the associated Texture2D resource as a Texture2D array resource, and then create a shader resource view for that resource. If you're using D3DX helper functions the easiest thing to do is this:

1. Load all of the textures using D3DX10CreateTextureFromFile, with a D3DX10_IMAGE_LOAD_INFO specifying that you want D3D10_USAGE_STAGING. Note that all of your textures need to be the same size, have the same format, and have the same number of mip levels
2. Map every mip level of every texture
3. Set up an array of D3D10_SUBRESOURCE_DATA's with number of elements == number of textures * number of mip levels.
4. For each texture, set the pSysMem member of a D3D10_SUBRESOURCE_DATA to the pointer you got when you mapped each mip level of each texture. Make sure you also set the SysMemPitch to the pitch you got when you mapped that mip level
5. Call CreateTexture2D with the desired array size, and pass the array of D3D10_SUBRESOURCE_DATA's
6. Create a shader resource view for the texture



all my files are loaded in as [color=#1C2837][size=2]ID3D10ShaderResourceView
[color="#1c2837"]

[color="#1c2837"]is there no way to make is use this to create another [color=#1C2837][size=2]ID3D10ShaderResourceView which is an array?[color="#1c2837"]

Share this post


Link to post
Share on other sites
No, like I said the resource (not the shader resource view) has to be created as an array for it to work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!