Page 1 of 1

DirectX9 Device lost

Posted: Mon Dec 10, 2018 3:21 pm
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

Re: DirectX9 Device lost

Posted: Mon Dec 10, 2018 7:07 pm
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).

Re: DirectX9 Device lost

Posted: Mon Dec 10, 2018 8:01 pm
by hedphelym
Does your screen go into sleep mode after 15 minutes?

Re: DirectX9 Device lost

Posted: Tue Dec 11, 2018 8:36 am
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.

Re: DirectX9 Device lost

Posted: Tue Dec 11, 2018 4:12 pm
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

Re: DirectX9 Device lost

Posted: Wed Dec 12, 2018 11:03 am
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.

Re: DirectX9 Device lost

Posted: Tue Jan 15, 2019 5:41 am
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.)

Re: DirectX9 Device lost

Posted: Wed Jan 30, 2019 10:40 pm
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)

Re: DirectX9 Device lost

Posted: Sun Feb 03, 2019 2:37 am
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.

Re: DirectX9 Device lost

Posted: Wed Mar 06, 2019 10:50 pm
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.