Jump to content
  • Advertisement
Sign in to follow this  
rpsathe

Available video memory

This topic is 4237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Nope. Since you can't even do it if you create a device. D3D is intentionally vague about how much free video memory there is, because it really doesn't matter at all. Some onboard graphics chips might not have any true video memory and might use system memory completely, whereas some might slice out 1GB of system memory on a 64MB card (Unlikely, but there's no reason why not) to use a AGP memory.

Why do you need to know how much video memory there is? IDirect3DDevice9::GetAvailableTextureMem() is the closest you'll get, but that's just a very rough ballpark figure.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Why do you need to know how much video memory there is?

A lot of devs like to scale the complexity of art assets based on the attributes of the current hardware (one of which is video memory). For example, on a card that has 256mb of memory, I may use my largest textures, while on a card with 64mb, I may switch to the smallest.

Unfortunately, to get reliable results, you are probably going to have to managed gathering this information yourself. Build a database of each card and how you want it to be handled. The SDK actually has a sample for one way in which this could be done - it's really just what fits your project.

Share this post


Link to post
Share on other sites
You'll want to be aware that some vendors pretend their cards have XXX megs of video memory (like 256 and more) while the card itself phisically has something like 16 megs, and the remainder is just shared AGP memory/system RAM

I dislike this situation because most casual player will actually think their hardware have great capabilities, will set you game to use the highest quality, end up with poor performance and blame your game/company/developpers' poor skills for that.

Share this post


Link to post
Share on other sites
Quote:
Original post by circlesoft
Quote:
Original post by Evil Steve
Why do you need to know how much video memory there is?

A lot of devs like to scale the complexity of art assets based on the attributes of the current hardware (one of which is video memory). For example, on a card that has 256mb of memory, I may use my largest textures, while on a card with 64mb, I may switch to the smallest.

Unfortunately, to get reliable results, you are probably going to have to managed gathering this information yourself. Build a database of each card and how you want it to be handled. The SDK actually has a sample for one way in which this could be done - it's really just what fits your project.
Actually, I do something similar to this in my engine. The engine checks the amount of texture memory availiable, and creates various sizes of sprite sheets depending on that amount.

However, I'm just relying on the size returned by D3D, not using the actual amount of physical VRAM.

Share this post


Link to post
Share on other sites
Quote:
Original post by rpsathe
Is there a way to get the available video memory in Direct X 9 without creating a device.

There is a way. I don't remember it, sadly. :) Programs that return information about devices (such as dxdiag in its display tab) can detect what the card claims it has. Windows' device enumeration functions can probably help get this. I don't remember currently how they go, but a google search of "enumerate devices windows" should put you on the right path.

Still, I'd suggest that you should only use this as a guideline, i.e., to set a default. Let the user select.

Share this post


Link to post
Share on other sites
It's just a thought but maybe it could work. As a one time thing, start allocating huge textures in the default pool. Do this until you get D3DERR_OUTOFVIDMEM or whatever it's called and then gradually decrease the texture sizes till you can't do it anymore. Then you will check the number and size of the textures you managed to allocate and calculate a rough estimate. Could this be viable? Never tried it.

Share this post


Link to post
Share on other sites
Default pool doesn't guarantree on-card memory. Allocating render targets is probably a better guarantee -- about as good a guarantee as the number you'd get from querying the device (however that is done).

Share this post


Link to post
Share on other sites
Also consider the effects of newer mobile chipsets. Right now I have "16MB" video card, but if the video drivers "decide" I need more, it will dynamically update the cards memory to as much as 128MB. A lot of newer laptops whose video chipsets/video card use shared memory work like this.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!