can not reset the direct3d device
Hi All,
when my app run, in time i screen server, my app display error can not reset the direct3d device
can anybody help me?
thanks
When your device is lost you should call TestCooperativeLevel. When that returns D3DERR_DEVICENOTRESET, you can then call Reset. Note that you have to release your resources when the device is lost and restore them after the device is reset.
thanks
my application is create window parent and render window child, window parent not use directx, window child use directx to render avatar. only error with this case.
when i create window render is windown parent then have not this error.
can you help me?
thanks
my application is create window parent and render window child, window parent not use directx, window child use directx to render avatar. only error with this case.
when i create window render is windown parent then have not this error.
can you help me?
thanks
Could you post your lost device handling code and your device creation code? That might help me figure out what's going on.
Also, does this only happen when the screen saver kicks in, or does it also happen if you switch to another application and try to switch back?
Also, does this only happen when the screen saver kicks in, or does it also happen if you switch to another application and try to switch back?
thanks
with screen server or click mouse right on the screen pc and select properties continue select setttings and change screen resolution and click ok then error occur.
my code:
if( m_bDeviceLost )
{
// Test the cooperative level to see if it's okay to render
if( FAILED( hr = m_pd3dDevice->TestCooperativeLevel() ) )
{
// If the device was lost, do not render until we get it back
if( D3DERR_DEVICELOST == hr )
return S_OK;
// Check if the device needs to be reset.
if( D3DERR_DEVICENOTRESET == hr )
{
// If we are windowed, read the desktop mode and use the same format for
// the back buffer
if( m_bWindowed )
{
D3DAdapterInfo* pAdapterInfo = m_d3dSettings.PAdapterInfo();
m_pD3D->GetAdapterDisplayMode( pAdapterInfo->AdapterOrdinal, &m_d3dSettings.Windowed_DisplayMode );
m_d3dpp.BackBufferFormat = m_d3dSettings.Windowed_DisplayMode.Format;
}
//MessageBox(NULL, "a", "a", MB_OK);
if( FAILED( hr = Reset3DEnvironment() ) )
return DisplayErrorMsg( D3DAPPERR_RESETFAILED, MSGERR_APPMUSTEXIT );
}
return hr;
}
m_bDeviceLost = false;
}
HRESULT Reset3DEnvironment()
{
// Reset the device
if( FAILED( hr = m_pd3dDevice->Reset( &m_d3dpp ) ) )
return hr;
}
can you help me?
with screen server or click mouse right on the screen pc and select properties continue select setttings and change screen resolution and click ok then error occur.
my code:
if( m_bDeviceLost )
{
// Test the cooperative level to see if it's okay to render
if( FAILED( hr = m_pd3dDevice->TestCooperativeLevel() ) )
{
// If the device was lost, do not render until we get it back
if( D3DERR_DEVICELOST == hr )
return S_OK;
// Check if the device needs to be reset.
if( D3DERR_DEVICENOTRESET == hr )
{
// If we are windowed, read the desktop mode and use the same format for
// the back buffer
if( m_bWindowed )
{
D3DAdapterInfo* pAdapterInfo = m_d3dSettings.PAdapterInfo();
m_pD3D->GetAdapterDisplayMode( pAdapterInfo->AdapterOrdinal, &m_d3dSettings.Windowed_DisplayMode );
m_d3dpp.BackBufferFormat = m_d3dSettings.Windowed_DisplayMode.Format;
}
//MessageBox(NULL, "a", "a", MB_OK);
if( FAILED( hr = Reset3DEnvironment() ) )
return DisplayErrorMsg( D3DAPPERR_RESETFAILED, MSGERR_APPMUSTEXIT );
}
return hr;
}
m_bDeviceLost = false;
}
HRESULT Reset3DEnvironment()
{
// Reset the device
if( FAILED( hr = m_pd3dDevice->Reset( &m_d3dpp ) ) )
return hr;
}
can you help me?
Hmmm. I don't think it's a good idea to change your screen resolution while a DirectX application is running. That's not something that a user would normally do, and I don't think DirectX likes it, either. Does your screen saver also change screen resolution/color depth?
thanks
yes, i see but i want test my app in all case. example when you run application and you go out to work anything on the time your pc automatic logout when you come back you must login when my app is error.
yes, i see but i want test my app in all case. example when you run application and you go out to work anything on the time your pc automatic logout when you come back you must login when my app is error.
Ok. I think I'm wrong about the resolution change issue. You would get a D3DERR_DEVICELOST when the resolution is changed to give you an opportunity to reset things when you get control back.
Are you releasing all DirectX resources before trying to reset the device? If not, it won't let you reset. I don't know why that would be an issue for a child window, but not a top-level window, but stranger things have happened.
Are you releasing all DirectX resources before trying to reset the device? If not, it won't let you reset. I don't know why that would be an issue for a child window, but not a top-level window, but stranger things have happened.
I don't know how to post an image. Sorry. Also, it's 3am and I have to work today. I'm going to bed. I'll check back when I can and try to help if someone else hasn't already gotten you taken care of.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement