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?
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
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.
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.
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.)
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)
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.