Jump to content

  • Log In with Google      Sign In   
  • Create Account


how do i load ID3D10ShaderResourceView* into texture2darray


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 thedodgeruk   Members   -  Reputation: 124

Like
1Likes
Like

Posted 18 October 2011 - 04:12 PM

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

Sponsor:

#2 MJP   Moderators   -  Reputation: 10273

Like
0Likes
Like

Posted 18 October 2011 - 04:31 PM

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

#3 thedodgeruk   Members   -  Reputation: 124

Like
1Likes
Like

Posted 18 October 2011 - 04:36 PM

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 ID3D10ShaderResourceView


is there no way to make is use this to create another ID3D10ShaderResourceView which is an array?



#4 MJP   Moderators   -  Reputation: 10273

Like
0Likes
Like

Posted 18 October 2011 - 05:44 PM

No, like I said the resource (not the shader resource view) has to be created as an array for it to work.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS