DirectX9 Device lost

Problems building or running the engine, queries about how to use features etc.
Post Reply
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

DirectX9 Device lost

Post by Pellaeon »

Ogre Version: 1.11.3
Render System: DirectX9

Hi,

I have issues with my program on some PCs. My application starts normally and runs fine, but after a whilethe DirectX9 Device enters the lost state.
Below you can see an excerpt of the log. It says D3D9 Device 0x[0000000003E79280] entered lost state and then an ItemIdentityException is thrown in a loop.
I really have no idea whats the reason for this. So what can be reasons that the DirectX device is lost?

Regards

Pellaeon

Code: Select all

7:42:43: Finished parsing scripts for resource group N30.scene
07:42:43: Creating resources for group N30.scene
07:42:43: All done
07:42:43: Removed resource location c:\NoCrash\models\Extensions
07:42:43: D3D9 Device 0x[0000000003E79280] entered lost state
07:42:43: Warning: D3D9: disabling VSync in windowed mode can cause timing issues at lower frame rates, turn VSync on if you observe this problem.
07:42:43: !!! Direct3D Device successfully restored.
07:42:43: D3D9 device: 0x[0000000003E79280] was reset
08:01:38: D3D9 Device 0x[0000000003E79280] entered lost state
08:01:49: D3D9 Device 0x[0000000003E79280] entered lost state
08:01:49: Ogre::ItemIdentityException::ItemIdentityException: Cannot find buffer binding for index 0 in VertexBufferBinding::unsetBinding at d:\projects\cpp\ogre-1.11.3\ogremain\src\ogrehardwarevertexbuffer.cpp (line 769)
08:01:49: D3D9 Device 0x[0000000003E79280] entered lost state
08:01:49: Ogre::ItemIdentityException::ItemIdentityException: Cannot find buffer binding for index 0 in VertexBufferBinding::unsetBinding at d:\projects\cpp\ogre-1.11.3\ogremain\src\ogrehardwarevertexbuffer.cpp (line 769)
08:01:49: D3D9 Device 0x[0000000003E79280] entered lost state
08:01:49: Ogre::ItemIdentityException::ItemIdentityException: Cannot find buffer binding for index 0 in VertexBufferBinding::unsetBinding at d:\projects\cpp\ogre-1.11.3\ogremain\src\ogrehardwarevertexbuffer.cpp (line 769)
08:01:49: D3D9 Device 0x[0000000003E79280] entered lost state
08:01:49: Ogre::ItemIdentityException::ItemIdentityException: Cannot find buffer binding for index 0 in VertexBufferBinding::unsetBinding at d:\projects\cpp\ogre-1.11.3\ogremain\src\ogrehardwarevertexbuffer.cpp (line 769)
08:01:49: D3D9 Device 0x[0000000003E79280] entered lost state
User avatar
saintnick
Halfling
Posts: 51
Joined: Tue Nov 27, 2018 1:41 am
x 5

Re: DirectX9 Device lost

Post by saintnick »

Code: Select all

07:42:43: Removed resource location c:\NoCrash\models\Extensions
Could this be the culprit? I am new to Ogre but it seems like your problems start right after the resources are removed (according to the timestamps).
hedphelym
Gremlin
Posts: 180
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23
Contact:

Re: DirectX9 Device lost

Post by hedphelym »

Does your screen go into sleep mode after 15 minutes?
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: DirectX9 Device lost

Post by Pellaeon »

saintnick wrote: Mon Dec 10, 2018 7:07 pm

Code: Select all

07:42:43: Removed resource location c:\NoCrash\models\Extensions
Could this be the culprit? I am new to Ogre but it seems like your problems start right after the resources are removed (according to the timestamps).
No, this is normal and not the reason for the problem
hedphelym wrote: Mon Dec 10, 2018 8:01 pm Does your screen go into sleep mode after 15 minutes?
Also no. The screen is always active, energy-saving options are disabled.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: DirectX9 Device lost

Post by dark_sylinc »

I talk about possible reasons for D3D11 device removal in another post.

D3D9 device lost reasons can be broader: Out of GPU memory, a bad shader (i.e. a pixel shader that does not return a float4 is usually a broken one, unlike D3D10+), hitting Alt+Tab (this shouldn't be a problem since Windows Vista, but...), generic memory corruption.

Turn on the DX9 Debug Layers from the Control Panel. These debug layers can catch a lot of API misuse that happens to work fine in your GPU but breaks in another machine.

If you post the beginning of the Ogre log where all the system info is dumped we may get a hunch.

Cheers
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: DirectX9 Device lost

Post by Pellaeon »

Thanks for the hint. I will check this. But I don't think that bad shaders are the reason. The model uses FFP and the program runs for a while (20 minutes or longer, somtimes hours) and somewhen the above noted error occurs. So further tips/hints/ideas are very welcome.
User avatar
EricB
Bronze Sponsor
Bronze Sponsor
Posts: 360
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 213
Contact:

Re: DirectX9 Device lost

Post by EricB »

Little bit of necro replying for me, (Since I am no longer active on the IRC channel, I figured I'd be more proactive on the forums a bit.)

Lost GPU state is a plague with the DirectX9 renderer. You'll run into crashing issues with end user setups if you don't solve it. This happens anytime that the DirectX window is not in focus.

Easiest way to fix it is to enable DirectX9Ex in the namevaluepairlist. The value is "Allow DirectX9Ex", the settings is "Yes". (I believe this is disabled by default.)

Enabling DirectX9Ex will give DX9 some DX10 features which should cause it not to lose the GPU state. Thus fixing Alt-tab and other GPU lost states on Vista and newer. (In theory, not sure how well it works in practice.)
Image
loath
Platinum Sponsor
Platinum Sponsor
Posts: 290
Joined: Tue Jan 17, 2012 5:18 am
x 67

Re: DirectX9 Device lost

Post by loath »

i'm seeing this now on 1.11.5 when i task away and then back to full screen. i never saw lost state crashes on 1.8.1. i will try eric b's suggestion before opening a bug.

13:30:21: Ogre::ItemIdentityException::ItemIdentityException: Cannot find buffer binding for index 0 in VertexBufferBinding::unsetBinding at C:\source\ogre3d\ogre-1.11.5\OgreMain\src\OgreHardwareVertexBuffer.cpp (line 769)
loath
Platinum Sponsor
Platinum Sponsor
Posts: 290
Joined: Tue Jan 17, 2012 5:18 am
x 67

Re: DirectX9 Device lost

Post by loath »

are you using Ogre Overlays? if so, that code was crashing by trying to unset bindings that were not present. a fix was submitted to ogre 1.11.
User avatar
EricB
Bronze Sponsor
Bronze Sponsor
Posts: 360
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 213
Contact:

Re: DirectX9 Device lost

Post by EricB »

are you using Ogre Overlays? if so, that code was crashing by trying to unset bindings that were not present. a fix was submitted to ogre 1.11.
Sorry for the late reply. Yes, I make heavy use of Overlays.

I used to have these problem in Ogre 1.7, but it was fixed by bouncing up to 1.10 and later 1.11.5, from 32-bit to 64-bit, and using the DirectX9Ex stuff.

I also have some code in my game for when the window regains focus. It waits a second, dumps all the GUI (overlays), then redraws them. If you would like it, I could post it. Not sure if that makes any difference.
Image
Post Reply