Sign in to follow this  
CDProp

Lost devices

Recommended Posts

If a device is lost, I understand you have to free all resources in the default memory pool prior to resetting, and then recreate the resources afterwords. I was wondering, instead of freeing the resources and reloading them from file, would it be possible to move the resources to another pool temporarily, and then move it back once the device has been reset? Even if only by creating a clone of the resource somehow? I'm trying to think of the fastest solution possible. Edit: I should probably mention that I'm using DirectX 9 with C++ Edit2: And I guess D3DPOOL_DEFAULT wouldn't typically be used for resources that are loaded from file, but I'm still curious.

Share this post


Link to post
Share on other sites
Assuming you're talking about Windows XP and not Vista onwards, You can lose your device if a user alt tabs out of your game too, so you can't really rely on knowing when you're supposed to move/backup your resources.

Any kind of static data should be loaded using the managed pool. This will keep a copy of the resource in both system memory and in the vram if appropriate. Anything in the managed pool will not be lost on a device reset.

Stuff to go in the managed pool would be static vertex buffers (the level geometry, models etc)

I think you only really need to use the non managed pool for dynamic resources, as constantly updating a system memory resource will be slow. Dynamic resources would be stuff like a particle vertex buffer, or a dynamic texture. The kinds of things that are automatically generated per frame anyway. Anything loaded from a file such as a model or a texture should be in the managed pool.

Just saw edit2 - yep you're right :) I don't think it's technically possible to do what you want with the directx api, and I don't see the advantage of it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this