texture memory

When I create textures (Using the methods used in most tutorials with bitmaps), is the texture copied to video memory, or main memory?


It depends on what system/drivers you got. If you have a hardware accelerated board, it will most certainly be uploaded into the video memory.

If you use too many large textures, the ones that not fit into the video memory, will remain in the main memory.


Actually a bit more complicated than that…

For a software renderer, textures are always in main mem.

For a non-AGP hardware renderer (assuming it isn’t falling back to software for some reason), textures are always copied to video mem. Where they won’t all fit, this often leads to thrashing every frame, because most drivers current discard the least recently used texture. John Carmack has recently posted a plan file arguing that discarding MRU would probably be better, odd though it may sound.

For an AGP hardware renderer, textures can be stored in either main or video mem; it’s up to the driver and will depend on available vidmem.

Lastly, most if not all Windows drivers will keep a copy of the texture in main mem, even if they’ve uploaded it to video mem. This is because Windows can trash the contents of videomem without warning in some cases (e.g. BSOD).

Hope this helps :slight_smile: