Texture Memory Consumption

I had written a worklog entry about D2X-XL's memory consumption already a while ago, but recent developments in the v1.14 beta have led to new insights in that area I want to share here.

Let me start with how much sense it actually makes to use 512x512 textures (highest texture quality). Simple: It doesn't make sense. You see most textures from so far away that they get resized below even 256x256. This is particularly true for powerups, which you pick up before getting close enough (unless your ship is fully loaded with that powerup). Due to all the filtering OpenGL does I highly doubt you'd see a difference anyway. What the highest texture quality does is to consume insane amounts of memory. To give you some numbers: The high resolution powerup sprites amount for a total of 272 MB. The textures for Descent 2:Counterstrike level 1 consume a whopping 530 MB at the highest texture quality. What makes things worse is that the OpenGL driver will create a copy of each texture that is passed to it because it cannot know whether it might have to swap that texture in and out of video memory due to video memory restraints. That amounts to a total of over 1 GB just for playing that simple level.

I just wrote something about swapping textures. That is what will happen if your textures consume more memory than your video card has available for them - which is less than its total memory size, as it needs some video RAM for rendering and stuff like camera views and the like. Swapping textures to video memory will massively decrease your frame rate, and having your graphics card sitting in a 16 lane PCI express slot won't help that much, particularly as this process competes for RAM bandwidth with the CPU that running D2X-XL.

So if you want to kick yourself in the teeth rendering speed wise, turn on high resolution textures with a graphics card that has less than 768 MB of video RAM, one might say.

v1.14 will do a lot to relieve this situation though:

  • Unless explicitly told to do otherwise, D2X-XL will only preload a subset of all textures that might be used in a level; because actually many of these textures might not be needed at all, this saves a significant amount of memory. If necessary D2X-XL will load such textures on the fly.

  • High resolution powerup sprites will be forced to 256x256 pixels size, reducing their memory footprint to a little over 60 MB.

  • When 3D powerups are enabled before loading a level, high resolution powerup sprites will not be loaded at all. The powerup model's memory consumption is about 20 MB; compared to the sprites' maximum of 272 MB that is as good as nothing.

  • D2X-XL can be told to unload textures from memory it doesn't need any more after having passed them to the OpenGL driver. That may increase the time required for screen resolution and fullscreen mode switches, but in the case of the high resolution textures required for D2:CS level 1 this will reduce the texture memory footprint to about 150 MB (plus whatever the OpenGL driver needs for its texture copies).

All these measures taken together bring D2X-XL v1.14's memory consumption down to a fraction of that of previous program versions, and may mean for many players that they now can enable effects that slowed their game down to a slide show before, like smoke or coronas.

Additionally you can download a medium resolution texture pack for Descent 2 containing all textures pre-shrunk to 256x256 from my website (~70 MB). If you know you will never use the 512x512 textures, you can place these textures in the textures folder; otherwise put them in textures/256."