Jump to content
  • Advertisement
Sign in to follow this  

DX11 [DX11]Load Texture2DArray from file

This topic is 2342 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

Hi guys!

Saving texture arrays to DDS files via D3DX11SaveTextureToFile() works well.

If I try to load the very same file using D3DX11CreateShaderResourceViewFromFile(), I only get a Texture2D (NON-array), at least according to the SRV descriptor. However, the resource which the created SRV points to is indeed a texture array, as expected.

D3DX11GetImageInfoFromFile() fills D3DX11_IMAGE_INFO::ArraySize equal to the correct number of array slices. Just the SRV is "broken" and can/must be recreated by hand. It doesn't seem to matter whether I include a D3DX11_IMAGE_INFO instance in D3DX11_IMAGE_LOAD_INFO::pSrcInfo or not, when calling D3DX11CreateShaderResourceViewFromFile().

Is this a bug or Microsoft feature? :-) :-)

Share this post

Link to post
Share on other sites
Have you tried to load a texture array from a different source? Perhaps there is something special about the file that you are saving, but it doesn't sound like it...

Share this post

Link to post
Share on other sites
Not really, I don't have any other DDS files with arrays, besides those I create using D3DX functions. Or what did you mean by source? Like from memory or resource? I guess they use the very same loading code for that. D3DX11CreateTextureFromFile() seems to load the file correctly. Weird...

This is the file: http://shell.sh.cvut.../tex2Darray.dds

ID3D11Resource * res = NULL;
D3DX11CreateTextureFromFile(D3DD, L"tex2Darray.dds", NULL, NULL, &res, NULL);
D3D11_TEXTURE2D_DESC tex2Ddesc;

ID3D11ShaderResourceView * srv = NULL;
D3DERR_CHECKQ(D3DX11CreateShaderResourceViewFromFile(D3DD, L"tex2Darray.dds", NULL, NULL, &srv, NULL));
ID3D11Resource * res2 = NULL;
D3D11_TEXTURE2D_DESC tex2Ddesc2;

srvDesc.viewDimension == D3D11_SRV_DIMENSION_TEXTURE2D (wtf)
tex2Ddesc2.ArraySize == 2 (expected)
tex2Ddesc.ArraySize == 2 (expected)

Looks like a bug to me :-)

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!