• Advertisement
Sign in to follow this  

texture memory usage ?

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

gasp, I just realized that when I make into textures 24 bits bitmap files, they use roughly twice the expected memory. Specifically a 2.25 mb file (a 1024x768 screen @ 24 bits) will use 5.5 megs once made into texture. I can understand a part of it, I ask the texture to handle an alpha channel, so 4 bytes for each texel, but why this double amount? I use this call: D3DXCreateTextureFromFileInMemoryEx with these flags: D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_FILTER_NONE Any idea? Normal, abnormal?

Share this post


Link to post
Share on other sites
Advertisement
The graphics card doesn't actually store the texture with the same dimensions, it usually has it pitch x height, where pitch >= width. Also, how did you know it consumed 5.5 MB of texture memory?

Share this post


Link to post
Share on other sites
not making mipmaps.

I just calculated the memory usage by checking before and after the texturing of the file (with 2 stop points in my code). Also, as a whole, if I had say 100 mb of bitmap, my system memory will shrink by roughly 250 mb.

Share this post


Link to post
Share on other sites
Mipmaps are made automatically, unless you use the Ex version of the function and specify 1 level (0 levels means full mipmaps).

Your image is probably becoming 1024x1024, 32 bit... so 4MB. Plus mipmaps which adds on about 1/3... or 5.33MB.

Share this post


Link to post
Share on other sites
Right on the spot, Sir!

I used in a test squares bitmap files, switched to 1 for the Mipmap level, and its exactly the memory usage expected.

Many thanks.

Share this post


Link to post
Share on other sites
another related question. If I create some textures with a 32 bits depth, and some others with only 16, will it be handled correctly by DirectX then the video card (the aim is to have some 16 bits textures to reduce memory usage)

Share this post


Link to post
Share on other sites
Yes, all formats can be mixed willy-nilly. You can take an A8R8G8B8 texture, modulate by an L8 texture, then add on an R5G6B5 texture, and store the result in an X1R5G5B5 framebuffer and expect it to work just fine, assuming the hardware you're running on supports all those formats.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement