How can I got the true video memory information
I use two fuctions to get video memory information.One is the getcaps in Directdraw. The other is getavailabletexturemem in directx9. But the two fuctions just return the video memory changes when I play a movie by realplayer. When I just show a picture in Mspaint, the video memory information doesn't change at all. To confirm my video memory information, I use the caps viewer which ship with directx9. But no different result was found out.
So is there any other function to get video memory information?
Why the video memory doesn't change at all when show a picture?
thanks.
[609 byte] By [
mr3] at [2007-12-25]
Thanks for reply.
But do you have any evidence of memory usage when display an BMP file? If you try show a bmp file which size larger than your video memory, the operation may failed.And there is api which named blit used to display bmp file. The API should be used to transfer data from system memory to video memory.
mr3 at 2007-9-3 >

Thanks Bahnassi.
But I think the picture data should be put into the video memory when I want to show a picture on screen. The blit function should transfer the bits in system memory to video memory. What I mean is that the process of show a picture should consume the video memory, not just allocate memory to load bmp file.
mr3 at 2007-9-3 >

No it doesn't. It's not a memory "move". It's a copy of the bits from one place to another. Both memory areas are preallocated: your BMP in system ram, and your frame buffer in video memory. You just copy the values of the bitmap bits from the former to the latter.
The following figure might help:
Before blit:
Bitmap:
11000
01000
00100
00011
Video (a black screen):
00000
00000
00000
00000
After blit:
Bitmap:
11000
01000
00100
00011
Video:
11000
01000
00100
00011
Note that the number of fields didn't change after the blit...
Think about it this way: video memory has two sections.
First you have video buffer memory, that is used to display the actual monitor image. This is ALWAYS being used - data is simply being copied into it, overwriting whatever is already there. So the "amount" of memory in the video buffer section never increases or decreases.
Second you have texture memory. This IS consumed as textures are copied from system RAM to the video card. So at a certain point you can "fill it up" with textures, and can't copy any more until some are freed (removed).
Your .BMP image is being copied into the first section, the video buffer, for display. So there is no change in the amount of free memory. If your .BMP were used in a Direct3D texture object, then it would be copied into the texture memory section, and available free memory would decrease.
The main thing is you really shouldn't worry about this too much. You can't "use up" video buffer memory, and the system will manage texture memory for you by default - if you have too many textures it will remove the least-used ones to allow new ones to be copied. This is called "texture thrashing" and it can lead to slow performance when doing 3D graphics - in which case you need to look into managing your textures more carefully. You can find plenty of articles and tutorials on this by typing something like "texture management" into Google.
-tAE-
theAntiELVIS, thank you very much. Your answer is very helpful. You are the best.
Thanks to the detailed explanation again.
mr3 at 2007-9-3 >
