Game Development Community

Fixed gfxD3DDevice not resetting after standby/suspend/lock

by Ross Pawley · in Torque Game Engine Advanced · 07/26/2007 (3:58 pm) · 5 replies

We discovered an issue where the gfxD3DDevice would end up never updating, after either using XP's fast user switch, standby, screen savers (some machines) or suspend. To an inexperienced user, this would appear like a freeze of the game, and require a full restart. After some going through the code we managed to fix it with a simple change.

In gfxD3DDevice.cpp in beginScene(), add these lines at the top.
if (mD3DDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
      activate();

This will insure that if the device needs to reset, it will be, taking care of the issue entirely.

#1
07/27/2007 (12:53 am)
Great, should actually help to solve the ctrl-alt-del issue as well on XP Pro / Vista
#2
07/27/2007 (11:13 am)
It does indeed fix the Vista issue as well. Kudos to you for this bug fix! - I will make sure it gets added into 1.02.
#3
07/27/2007 (11:33 am)
Awesome! I'm curious to know if anyone has managed to get the issue (without the fix, that is, of course) to happen when coming back from a screensaver. The bug report that initiated this fix described specifically that this was the case, but I was unable to reproduce it in my tests. I'm sure this fixes it though, but I'd still like to know if others can reproduce it.

Also, with the fix it may or may not be a good idea to change the message handling to allow the system to go into standby, since currently it denies any standby requests.
#4
07/27/2007 (1:22 pm)
I am told that adding in the Standby changes would be too big a change to add into 1.02 right now, but definitely will be looked into later on.
#5
07/29/2007 (9:37 pm)
Makes sense, I just thought I'd point it out.