How to Get Video Mem(Local and Non Local)

Started by
3 comments, last by tien1228 20 years, 11 months ago
I am using DirectX8.1, How to get Texture Memory Total, and Free of it? how to get Local Texture Total Mem? and Free? How to get AGP Total? and Free?
Advertisement
- No direct way in >=DX8.x.

- You CAN get available texture memory in >=DX8.x using IDirect3DDevice*::GetAvailableTextureMem

- Since you likely only need this information when your application starts up, the most sensible way I can see if you *really do* actually need to know would be to create a DX7 DirectDraw object to get the individual amounts, then close that down and create your DX8+ D3D interface.

- Why do you need to know? You should ONLY use the values as a very rough guide (e.g. switch to higher detail textures if the device reports more than 8Mb - DO NOT rely on the figure for anything more).

- There is a lot going on inside D3D and the driver that you aren''t aware of. While you might think a 256x256x16 texture takes exactly 128Kb, on many chips it won''t!!! For example one chip might require 16 pixels of padding on every line to facilitate some clever texturing scheme so the texture really ends up taking 136Kb. Another chip may divide its video memory up only into square regions so the 16x128x32 texture you allocate might really be represented as a 128x128x32 block of memory on the chip. I could give plenty more examples, but the key point is NEVER rely on the "available memory" values for anything precise.

- Trying to second guess what the driver is up to, and how it''s going to handle it''s memory (if you''re wanting to write your own texture manager) is a bad idea - each driver is written by people who know that particular piece of hardware, including it''s nuances regarding memory use much better than you or I.

- Some older drivers report quite strange values for those. Some may report the same value for texture memory as they do for overall video memory. Some may return 0''s for certain elements. Some take off the memory used for the desktop screen, even if your device is fullscreen.

- Some devices such as a Voodoo2 in SLI mode (if you can find up to date drivers) may report amounts such as 32Mb or texture memory - however, this IS NOT contiguous and available for all textures - it''s split two ways between chips, and then two ways again between TMUs

- UMA devices. These use specially marked system memory as video memory, so you MIGHT come across a really modern, up to dated device which reports the amount of AGP memory as 0. Maybe even another device which reports the amount of local video memory as 0.

As you''ll hopefully see from the above, retrieving the amount of available texture memory is perfectly adequate for 99.99% of cases. In fact, getting for and relying on any more specific information is bad for compatibility if you rely on it as anything more than a GUIDE.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Thanks for your replay!

how can I get total AGP mem and free on runtime?

we are developing a 2D+3D game like Diablo2, we find the performence is very low on some situation, we guess it is caused
by upload too much texture from sys mem to vid mem per frame.
(we are using managed texture provided by D3d)

so we want record Vid mem Consume ervery frame.

the render process is
1.load our own defined image to sys mem when nedd render it
2.create a managed texture, lock it, fill it''s content
3.render it.

our game have very low polygong needed to render per frame,about
(500-1000 per frame)
the bottleneck is in upload texure from sys to vid.

how can I to do optimize?

thanks again!
Use WMI to get the actual physical local video memory size.

Caveats: WMI support (downloadable if < winXP), and a DX7 DDI driver



Development Lead
Windows Graphics & Gaming Technology
Development Lead, DirectXWindows Graphics & Gaming Technology
The screen keeps going straight to black because you keep telling it to immediately set the ramp to 0. Zero==black. What you should do, is either use some type of interrupt function, or even a while loop that checks a change in time. And slowly decrement the rgb values by one or two or five or whatever.

But just setting it all to 0 will make it go black immediately. Which isn''t really a fade.

c/c++ has some built in time functions (none that I can remember off the top of my head, I haven''t coded with it in a really long time), so there should be some information online about it.

This topic is closed to new replies.

Advertisement