Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

lost device and resource

This topic is 4834 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

when lost device and you need to recreate resource if not D3DPOOL_MANAGED but how can I know what resource need to create? I need a list to track what resource to be created?

Share this post


Link to post
Share on other sites
Advertisement
You need to create the resources specific to your application. A good flow desgin would help here -- the one found in the DX SDK framework is ok. It is like this:

1. Set up non-device objects.
2. Create the device.
3. Set up device objects.
4. Run (update and render)
5. Destroy device objects.
6. Delete the device.
7. Destroy non-device-objects.

In step (3) you will create the resources your game requires and (5) should be written to match it. Now for a device reset you can simply call (5), reset the device and call (3).

Greetz,

Illco

Share this post


Link to post
Share on other sites
Quote:
Original post by Illco
You need to create the resources specific to your application. A good flow desgin would help here -- the one found in the DX SDK framework is ok. It is like this:

1. Set up non-device objects.
2. Create the device.
3. Set up device objects.
4. Run (update and render)
5. Destroy device objects.
6. Delete the device.
7. Destroy non-device-objects.

In step (3) you will create the resources your game requires and (5) should be written to match it. Now for a device reset you can simply call (5), reset the device and call (3).

Greetz,

Illco


but Set up device objects everywhere everywhen.
I need a list to track what device objects to create?

Share this post


Link to post
Share on other sites
If you set them up all over the place you will have to, yes. But it is better to reconsider your design in that case. Note that the steps (3) and (5) are only top-level i.e. they can call sub functions. For example a typical (3) would look like:

InitDeviceObjects( void )
{
m_pScene = new CScene();

// Insert objects
// ...

m_pScene->InitDeviceObjects();
}

Note how the call is forwarded to the scene which will initialize all the objects, which in turn will initialize their device resources. This structured approach will help you organizing the objects and is much more stable than a list.

Greetz,

Illco

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!