Sign in to follow this  
thedodgeruk

how do i load ID3D10ShaderResourceView* into texture2darray

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
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
[quote name='MJP' timestamp='1318977118' post='4874065']
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
[/quote]


all my files are loaded in as [color=#1C2837][size=2]ID3D10ShaderResourceView[/size][/color]
[size="2"][color="#1c2837"]
[/color][/size]
[size="2"][color="#1c2837"]is there no way to make is use this to create another [/color][/size][color=#1C2837][size=2]ID3D10ShaderResourceView which is an array?[/size][/color][size="2"][color="#1c2837"]
[/color][/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this