Click here to Skip to main content
15,921,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Update:

When i press Control Alternative Delete, Direct3D Device get lost.
I restore it using recreation.
It works for windowed mode and failed for fullscreen mode.

I get

HRESULT: 0x88760868 (2289436776)
Name: D3DERR_DEVICELOST
Description: Device lost
Severity code: Failed
Facility Code: Unknown (2166)
Error Code: 0x0868 (2152)

as result of
// Create the device
hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
                           m_hWndFocus,
      D3DCREATE_HARDWARE_VERTEXPROCESSING |
                                    D3DCREATE_PUREDEVICE
      , &m_d3dpp,
                           &m_pd3dDevice );


//  Set up the presentation parameters
    ZeroMemory( &m_d3dpp, sizeof(m_d3dpp) );
    m_d3dpp.Windowed               = m_bWindowed;
    m_d3dpp.BackBufferCount        = 1;
    if( m_bWindowed )
        m_d3dpp.MultiSampleType    = D3DMULTISAMPLE_NONE;//pDeviceInfo->MultiSampleTypeWindowed;
    else
        m_d3dpp.MultiSampleType    = D3DMULTISAMPLE_NONE;//pDeviceInfo->MultiSampleTypeFullscreen;
    m_d3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
    m_d3dpp.EnableAutoDepthStencil = FALSE;
    m_d3dpp.AutoDepthStencilFormat = D3DFMT_X8R8G8B8;
    m_d3dpp.hDeviceWindow          = m_hWnd;
    if( m_bWindowed )
    {
        m_d3dpp.BackBufferWidth  = CONST_BackBufferWidth;
        m_d3dpp.BackBufferHeight = CONST_BackBufferHeight;
        m_d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
        m_d3dpp.FullScreen_RefreshRateInHz = 0;
    }
    else
    {
        m_d3dpp.BackBufferWidth  = CONST_BackBufferWidth;
        m_d3dpp.BackBufferHeight = CONST_BackBufferHeight;
        m_d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
        m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
    }

    m_d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
    m_d3dpp.MultiSampleQuality = D3DMULTISAMPLE_NONE;
    m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;




    // Create the device
    hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
                               m_hWndFocus,
                               D3DCREATE_HARDWARE_VERTEXPROCESSING |
                                        D3DCREATE_PUREDEVICE
                               , &m_d3dpp,
                               &m_pd3dDevice );
ShowWindow(m_hWnd,SW_SHOWMAXIMIZED);


Device can not be restored until if there is TestCooperativeLevel and it returns D3DERR_DEVICENOTRESET.
But it never happens in fullscreen mode.
Is it directx, display driver or nvidia stereo 3d video driver bug?
What should i do to resolve it?

Update:
When comes next media sample, i try to render it.
First i check if there is the device.
There is no device.
I try to restore it.
I get D3DERR_DEVICELOST result code.
The same for all next frames (media samples).
I tryed to use all Direct3D function in separate thread, but it gave no result.

It is actual.
Posted
Updated 4-Apr-11 22:59pm
v15
Comments
Anthony Mushrow 18-Mar-11 9:56am    
The error code says that you made an invalid call to the function. Could you post a code snippet showing how and where you reset the device?
[no name] 21-Mar-11 3:39am    
I do not get resolution to recreate device, but do it. That is why i have got this error code.
[no name] 21-Mar-11 7:57am    
I decided do not use Reset function, because it always fails.
Now i use recreation.

Please check the following link it might help you

http://www.gamedev.net/topic/312957-lost-device-in-d3d/
 
Share this answer
 
v2
Comments
JF2015 18-Feb-11 1:50am    
Fixed the link.
[no name] 18-Feb-11 9:25am    
There is only general proposition.
I have used it in my program.
[no name] 18-Mar-11 8:18am    
But the problem stays.
No "do reset" message received.
Its a long time ago at DX7. At this time we have to gain a new back- and frontbuffer if the viewport size has changed. But thats no problem: the meshes and textures still exist anyway.
But dont ask me for code, im afraid that i couldnt find it.
Regards.
 
Share this answer
 
Comments
[no name] 23-Mar-11 10:44am    
I have no textures and meshes. Function Reset does not work and recreating does not work. The problem is that, after device was lost, only some functions of the device work. Recreating device fails.
mbue 23-Mar-11 13:11pm    
Enshure to release all interfaces you have got (if(pBuffer) pBuffer->Release(); pBuffer=0;). If you dont, the interfaces will go into a zombie-state.
[no name] 25-Mar-11 6:10am    
I release all interfaces. But after that i cannot recreate interface LPDIRECT3DDEVICE9 object.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900