Archived

This topic is now archived and is closed to further replies.

wyrd

Resource and Memory Management

Recommended Posts

I''m starting my trek from DD over to D3D, and have some questions about resource classes (Textures) and their so called "Memory Management." Am I to understand that this is the process of shuffling resources around from system to video memory, and not actually creating and destroying the resource? Basically, if I have 2 gigs worth of graphics that I''ll be using throughout my game, I''m still going to use a Resource Manager that I make to cache resources (load from disk and unload from memory), right? Please keep in mind that I''m using C#, although I doubt it makes much of a difference.

Share this post


Link to post
Share on other sites
There are two managers here, the one you do and the one Direct3D does. If you create managed resources with Direct3D it, along with the driver, will put the resource in the best place possible e.g. video or AGP ram. You no longer worry about that side of things. So if you are never going to edit a resource then make it managed and let D3D handle where to put it. The other manager would be one you create yourself to habdle all your level data and arrange for the loading and removal of resources.

Share this post


Link to post
Share on other sites
Ah okay, so I was correct. This is what I initially thought, but the explanation of Resource.Priority threw me for a loop;

quote:

Priorities are used to determine when managed resources should be
removed from memory. A resource assigned a low priority is removed
before one with a high priority. If two resources have the same
priority, the one that was used more recently is kept in memory, while
the other is removed. Managed resources have a default priority of 0.



Right here; "determine when managed resources should be
removed from memory." I assume they mean removed from video memory, and not memory altogether?

Share this post


Link to post
Share on other sites
Yes. DirectX keeps two copies of managed resources, one in system memory and one in video or AGP memory so it can switch resources in and out. This is why if your device is invalidated you do not need to reload your managed resources. Of course if the device is changed e.g. switching from windowed to full screen you will then need to reload the resources

Share this post


Link to post
Share on other sites