Leaving textures in memory, good or bad? 2004-03-05 - By NoiseCrime
Back -- -- Original Message -- -- From: "Barry Swan" <gerbil@(protected)> To: <dir3d-l@(protected)> Sent: Thursday, March 04, 2004 8:42 PM Subject: [Dir3d-l] Leaving textures in memory, good or bad?
Memory usage of textures, my take on it.
1. Cast member You gotta get you texture from somewhere, and most of the time it will be a cast member. So Director most load and decompress the bitmap into standard ram . It will remain there until you unload it, or Directors own housekeeping detects its no longer in use.
2. Texture When you create a texture SW3D will store a bitmap version into main ram, this will be compressed if you set the texture to have compression. Then this bitmap is uploaded to the API (not card) as a texture to the properties you've set in the texture palette entry (renderformat and renderquality (i.e mipmaps)) If it has mipmaps these will be created and also uploaded.
However there is no gaurantee at this stage that the texture will be placed in the cards vram, thats entirely up to the API to decide, you have no control over it. If its not on the card then its going to be in your main memory.
So in terms of memory a single texture can actually use quite a bit. First there is the bitmap in Directors cast, then there is the stored bitmap for sw3d, that allows you to switch renderformat/qauilty on the fly, and finallly the version that is 'meant' to be on the card, but might not be (which also might have mipmaps).
First its clear that the director copy of the bitmap is usually surpluss to requirements, and so once its been loaded as a texture the member may be deleted, unloaded or ignored (allow Director to sort it out).
Secondly you'll have two copies of the texture, the bitmap (compressed) version and the actual texture version. The first will remain in main memory until it is deleted from sw3d,the second may be on the card or in main memory and is used by the API, including mipmaps. Again this version remains until deleted from sw3d.
In the main there is no need to delete these versions, unless you no longer need them. If you do a resetworld() between levels of a game or something they will automatically be deleted anyway. The only possible reason is if you need to display many large textures and would run out of main memory unless you deleted ones that were no longer in use. I thinking here if you're doing a slide show with 2048x2048 textures or something, where its clear you'd want to delete old ones from memory.
Hope this helps.
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|