ram
Blitz3D Forums/Blitz3D Beginners Area/ram
| ||
i have a problem my game in memory is 30mb!!!! is very big and only have two rooms, if no read lightmap is 29mb, the b3d file is very big in memory, how resolve this problem? |
| ||
Is this V-RAM? If so remember that when you use the graphics command and use double buffering, your using V-RAM. Can't remember the maths, but it's something like: res: 800x600x32, double buffering. 800x600*32 /8 to get to bytes = 1,920,000 B = 1.83 Mb * 2 (double buffering) = 3.66 Mb That's just for the screen set-up. You also will have textures to. Check the size of them. If you have mip-mapping enabled, i believe it creates 3 versions of your textures, for less detail far away. This can all add up. Also check for memory leaks. You might be creating entities and not freeing them when finished. |
| ||
This test reckons a 800x600 16-bit graphics buffer (yes, my desktop is 16 bit also) uses 711k for both the front AND back buffers. Using Ross's maths it would be 937k per buffer. But as you said, maybe the maths are a bit off...A% = AvailVidMem()/1024 Graphics 800,600,16,2 B% = AvailVidMem()/1024 Text 0,0,"VidMem usage: " + (A - B) + "k" WaitKey End |
| ||
Few formulas to calc VRAM usage (my old post)... http://www.blitzbasic.co.nz/Community/posts.php?topic=24157 Another blatant bump for DXTC! :) |
| ||
i found the problem, i use b3d pipeline and the texture by default load in ram and not in video ram, i check the flag vidram and now only 18mb :) |
| ||
In 16 bit mode you are using 2 bytes per pixel. To display a full screen would be 800x600x2=960,000. Duble buffering would be twice that or 1,920,000 In 24 bit mode you are using 3 bytes per pixel and in 32 bit mode you are using 4 bytes per pixel. A 1024 x 768 32 bit full screen would use: 1024x768x4=3,145,728 bytes per screen and dubble buffering would use twice as much. That's the math, for the display itself, impossible to be less. Other video features could increase this though. In answer to your question about the large memory used. DirectX stores textures and 3D objects in video memory for quicker rendering. It is much faster to move data from one area of video memory to another than from computer memory to video memory. Some video memories run at 800 mhz while most computer memories still run at less then 200 mhz. To lower your video memory useage you must lower the number of textures or objects you are loading at once. Only load what you need when you need it. When dealing with textures the same math as above applies. A 512x512 32 bit texture uses 1,048,576 bytes, of your video memory to store it there for use. One common mistake people make is they look at a jpg that is 150k long and think it only uses 150k, but jpg's are highly compressed files, and are expanded by your computer when they are loaded. So that 150k jpg could easily use 2 megs of memory when loaded. To lower your memory useage you could use 256x256 16 bit textures which only use 131,072 bytes per texture when loaded. That's only 1/8 as much. as the 512x512 32 bit. I hope this helps explain the large memory useage question. |
| ||
@ David, what size of texture are you using? |
| ||
i check the flag vidram and now only 18mb :) So I'm guessin we users will require a vid card of over 12mb to run yer program? |
| ||
256*256 for textures and 128*128 for lightmaps |