nqsa / nebula3

Automatically exported from code.google.com/p/nebula3
0 stars 1 forks source link

the device lost is not handled cerrectly #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run testgame.exe
2. Win+L to lock Windows
3. the D3D9RenderDevice::Present() will fail

the n_assert will exit the program, so i change the code to:
=================================================================
    if (0 != D3D9DisplayDevice::Instance()->GetHwnd())
    {
        HRESULT hr = this->d3d9Device->Present(NULL, NULL, 0, NULL);
        n_assert(SUCCEEDED(hr) || D3DERR_DEVICELOST == hr);
    }
=================================================================
but the num of device lost handlers is zero, so the Reset() would always 
return FAIL! so it renders nothing.
=================================================================
    else if (D3DERR_DEVICENOTRESET == hr)
    {
        // notify event handlers that the device was lost
        this->NotifyEventHandlers(RenderEvent(RenderEvent::DeviceLost));
=================================================================
I switch to DEBUG version of DirectX, and get some information. I think 
the the render target should recreate when the device is lost

Original issue reported on code.google.com by xoyoj...@gmail.com on 20 Sep 2008 at 6:01