Jump to content
  • Advertisement
Sign in to follow this  

[DX9] D3DXCreateTextureFromFileInMemoryEx question

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

Hello, I load a file which contains several dds images.

Does the D3DXCreateTextureFromFileInMemoryEx argument LPCVOID pSrcData start before or after the header? It is a DXT3 compressed dds image from memory.

I figure since so much of the arguments could be found in the header then my assumption that the header is not needed for this function is correct.

So, D3DXCreateTextureFromFileInMemoryEx= no header needed?
And D3DXCreateTextureFromFileInMemory = header needed?


HRESULT D3DXCreateTextureFromFileInMemoryEx(
__in LPCVOID pSrcData,
__in UINT SrcDataSize,
__in UINT Width,
__in UINT Height,
__in UINT MipLevels,
__in DWORD Usage,
__in D3DFORMAT Format,
__in D3DPOOL Pool,
__in DWORD Filter,
__in DWORD MipFilter,
__in D3DCOLOR ColorKey,
__inout D3DXIMAGE_INFO *pSrcInfo,
__out PALETTEENTRY *pPalette,
__out LPDIRECT3DTEXTURE9 *ppTexture

pSrcData [in]
Pointer to the file in memory from which to create the texture.

Share this post

Link to post
Share on other sites
The function does require file header data as well.

The rest of the input parameters describe the desired destination texture properties, which may or may not be same as in the original image.Furthermore, the function works with many other formats in addition to DDS, that may not have the same file contents organization.

Share this post

Link to post
Share on other sites
That sucks :/ guess I have to CreateTexture and copy layer info with Rectlocking. Or maybe I can just remake a header and append the dds pixel data?

Share this post

Link to post
Share on other sites
The function doesn't care whether or not the original data is actually read from file or somewhere else, so you could provide your own header and concatenate it with the rest of the data before feeding the memory to it.

More often than not, however, content files in packages (which, I assume, is your scenario here) are actually of varying dimensions and formats. The DDS header isn't exactly huge, and leaving it with each file in memory would make your life easier in the long run.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!