View Full Version : Game coding for Graphics RAM
Quick question...
How are games coded to use Graphics RAM? Will some games use everything the card has, or are they written to fit within a certain limit, to match the GPU RAM available or upcoming at the time of coding?
Cheers :)
K
ahmad
02-08-2007, 09:25 AM
A typical game engine will just load as many textures as it can into the graphics board memory. Once it runs out, it gives an error and the game engine handles that error by buffering in main system memory.
I don't think there are games that optimize for a certain amount of memory. If they did it would restrict users with a lot of graphics memory. They could have an option, but it would be pointless because you never want to use a certain amount of memory; you need to utilize as much as possible.
Not to mention that the GPU will use more memory if any anti-aliasing or filtering is used, making for less texture space.
Thats why a lot of engines try to cleverly determine the minimum amount of textures that need to be displayed on the screen, and try to figure out where the user is going next by allowing some room for the next scene.
DTU_XaVier
02-08-2007, 01:10 PM
The best example is probably the "Ultra" quality setting of Doom3/Quake4... There the game's automatically instructed to use, if not a specific, then at least a higher amount of RAM... But other than that... No, not really, as ahmad already said.. :)
Best Regards :toast:
Typically you ignore the problem. You let the user pick a set of textures that probably fits, or if he/she didn't you use one that probably fits.
Then you ignore details and just render away as the graphics subsystem will transparently swap textures in and out, just as you do with main memory. The textures kicked out will not go to disk, they go into main memory in the aperture region. This is pretty quick these days, that's the reason why you can use Doom3 with ultra textures (requiring a 512 MB card) on a card with 256 MB if you have x16 PCIe and fast memory (and even if not).
You use glPrioritizeTextures() to tell the system which textures it should prefer to kick out and which to keep when it comes to kick things out. You set that once, then the graphics subsystem implements the policy you set.
If you have the choice to render a texture or not and are in a time-critical situation you can use glAreTexturesResident() to ask the card whether a given texture is current present. And use it if it is and follow an alternative plan if not.
If the system actually fails to load a texture because you have video RAM and aperture region both filled up you either refuse to start the program or you fall back to some alternate plan such as using a smaller texture set or replace some surfaces' textures with colors.
ahmad
02-08-2007, 03:58 PM
That is one thing I wanted to mention: texture quality. That plays a huge rule because the lower the quality, the less memory used. So if you use uncompressed textures in Doom/Quake, you end up with massive memory usage, but textures look the way they were drawn by the artists.
So if you play a good game but your video card lacks in memory but you want to keep AA and a decent res, just lower your texture quality and it will improve things significantly.
:D Thanks for the answers!
I`ve been wondering on and off for a while if the extra RAM on high-end cards (The 512MB versions of the 6800 and 7800 in particular) were in a position to benefit games, or if they were solely for bragging rights. I guess that moves onto the 768MB RAM of the G80GTX, and the differences in the 320MB and 640MB versions of the GTS.
:toast:
Also keep in mind that modern graphics APIs don't use up memory according to the old formula anymore.
In the old days you knew you had the framebuffer going off your VRAM and the rest is for textures. Everything else is only minimal.
That's not the case anymore, shader programs in particular can take up new kinds of spaces in VRAM.