Sign in to follow this  
ruysch

readback texture created with D3DX10CreateTextureFromFileA

Recommended Posts

Is there a simple way of reading back the contents of a texture created with D3DX10CreateTextureFromFile ? I have attempted to get data from mipmap level zero but the first call to map () below fails:
D3D10_MAPPED_TEXTURE2D mappedTexture;
hr = md_pTexture->Map (D3D10CalcSubresource (0, 0, 0), 
  D3D10_MAP_READ, 0, &mappedTexture);

md_pTexture->Unmap (D3D10CalcSubresource (0, 0, 0));

Is there any official way of reading back texture data?

Share this post


Link to post
Share on other sites
You can override the usage in the D3DX call with the D3DX10_IMAGE_LOAD_INFO parameter to load the texture as a staging resource with cpu read capability and no bind flags. Don't expect it to work as a shader resource after that, but you can read it with Map.

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