Jump to content
  • Advertisement
Sign in to follow this  

Handling mid-frame device lost (DX9) and locking

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


I know how to handle a lost device and recovering it. I have a method CheckDeviceCooperativeLevel that calls TestCooperativeLevel and handles D3DERR_DEVICELOST and D3DERR_DEVICENOTRESET properly. It returns true only if TestCooperativeLevel succeeds. My main render loop that gets called once a frame looks like this:
if (CheckDeviceCooperativeLevel)
// Do all the drawing
The question I have is at what times can a device get lost? Assume I lock a buffer inside the drawing loop. Can I assume that locking that buffer always succeeds or can the device get lost between TestCooperativeLevel and the locking operation? Are there only certain instances when a device gets lost or can it happen any time? So for instance if I upload my textures inside the drawing loop, do I have to try again next frame if uploading fails or can I assume that it will always succeed? Similarly for CreateQuery - do I have to handle the case when that fails?

- Lutz

Share this post

Link to post
Share on other sites
[font="Calibri"]A device lost can happen all the time but the runtime is written I a way that in most cases you don’t need taking care mid frame. [/font]

[font="Calibri"]Locking of resources depends on the memory poll. It will work fine as long as the resource is not in the default pool. But as default pool resources need to be recreated after a device lost anyway you normally need only make sure that your app is not crashing when the locking fails.[/font]

[font="Calibri"]To be honest I am not sure about creating querys in device lost state. But as you don’t need to recreate them during a reset operation it should be possible to create them during device lost state.[/font]

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!