DirectX9 Device lost

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

DirectX9 Device lost

Post by Pellaeon » Mon Dec 10, 2018 3:21 pm

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
1 x

User avatar
saintnick
Halfling
Posts: 51
Joined: Tue Nov 27, 2018 1:41 am
x 2

Re: DirectX9 Device lost

Post by saintnick » 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).
0 x

hedphelym
Gremlin
Posts: 158
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 9
Contact:

Re: DirectX9 Device lost

Post by hedphelym » Mon Dec 10, 2018 8:01 pm

Does your screen go into sleep mode after 15 minutes?
0 x

Pellaeon
Halfling
Posts: 95
Joined: Thu Apr 28, 2011 12:23 pm
x 3

Re: DirectX9 Device lost

Post by Pellaeon » Tue Dec 11, 2018 8:36 am

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.
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3961
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 175
Contact:

Re: DirectX9 Device lost

Post by dark_sylinc » Tue Dec 11, 2018 4:12 pm

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
0 x

Pellaeon
Halfling
Posts: 95
Joined: Thu Apr 28, 2011 12:23 pm
x 3

Re: DirectX9 Device lost

Post by Pellaeon » Wed Dec 12, 2018 11:03 am

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.
0 x

User avatar
EricB
Gnome
Posts: 314
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 103
Contact:

Re: DirectX9 Device lost

Post by EricB » Tue Jan 15, 2019 5:41 am

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.)
1 x
Image

loath
Platinum Sponsor
Platinum Sponsor
Posts: 89
Joined: Tue Jan 17, 2012 5:18 am
x 1

Re: DirectX9 Device lost

Post by loath » Wed Jan 30, 2019 10:40 pm

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)
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 89
Joined: Tue Jan 17, 2012 5:18 am
x 1

Re: DirectX9 Device lost

Post by loath » Sun Feb 03, 2019 2:37 am

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.
0 x

User avatar
EricB
Gnome
Posts: 314
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 103
Contact:

Re: DirectX9 Device lost

Post by EricB » Wed Mar 06, 2019 10:50 pm

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.
0 x
Image

Post Reply