Sign in to follow this  
btaraman

Texture Footprints

Recommended Posts

btaraman    122
Hello DX experts, I have some doubts about DX texture formats, specifically when they are loaded to the video card memory. I would like to know how much memory a texture of 512x512 pixels, 16bits of depth occupies when loaded into my video card memory. Is there a way of reducing the size that this texture occupies, by using some compressed format? How do I query for the amount of memory that is currently allocated in my video card? All references and answers are welcome. Thanks for the answers!

Share this post


Link to post
Share on other sites
darookie    1441
Quote:
Original post by btaraman
I would like to know how much memory a texture of 512x512 pixels, 16bits of depth occupies when loaded into my video card memory.

Do the math: it's at least 512x512x16 bits, e.g. 512KiB plus some unspecified driver overhead (probably just a few bytes). Keep in mind that depending on the memory pool, a copy of the texture data might reside in system RAM. In case you use MIPMAPs, the amount would be up to 768KiB, depending on the number of MIP levels stored.
Quote:

Is there a way of reducing the size that this texture occupies, by using some compressed format?

You can specify - or even better yet store - your textures in a compressed format such as DXTn. Beware though that the texture quality might suffer from this, especially colour gradients. There are 5 defined (and hardware-supported) DXT-formats, but only three of them are of practical relevance:

  • DXT1 - 4 bits per pixel with optional alpha mask support

  • DXT3 - 4 bits per pixel with 4 bit per pixel uncompressed alpha channel (e.g. 8 bpp total)

  • DXT5 - 4 bits per pixel with interpolated, compressed alpha channel (8 bpp total)


The dxtex.exe (does it still go by that name?), found in the DXSDK's tools folder can be used to convert your textures into these formats. It also features an interactive preview allowing you to evaluate the compressed texture and alpha channel quality. Compressed textures are stored in the DDS format. The DXSDK comes with Adobe® Photoshop™ and Corel® Paint Shop Pro™ compatible import and export filters, but the aforementioned texture tool should be sufficient to (batch-) convert your files.
Quote:

How do I query for the amount of memory that is currently allocated in my video card?

I don't know if it's even possible to query the actual amount of used memory, since the card driver is free to optimise and organise the card's allocated memory. You can, however, get a fair estimate by using the figures given in the MSDN docs that describe the DDS format (follow the links therein).

HTH,
Pat.

EDIT: repaired the link [smile] I also don't know if the information is correct/up-to-date. It's been a while since I fiddled with Direct3D [smile]

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