Click here to Skip to main content
15,893,814 members

Device lost in directshow renderer filter (fullscreen mode recreation fail)

Kozlov_Sergey asked:

Open original thread
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.
Tags: C++, Windows, DirectX, DirectShow

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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