Sign in to follow this  
thuong

reset device error

Recommended Posts

hi all, i have problem with reset device i create device in the main thread, render other thread, following is render funcrions // 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_bFullscreen) { m_pd3dMDeviceGfx->ForResetDevice(m_iRenderUnit); } m_bNeedResetDevice = true; m_bErrorMode = TRUE; return S_OK; ///} } } } if(!m_bErrorMode) { // Tell client to render using the current device Render(); } - To reset device i use WndProc to check have need reset device and call reset, but it have some error. Direct3D9: (ERROR) :Reset fails. D3DERR_DEVICELOST returned. Direct3D9: (ERROR) :Reset failed and Reset/TestCooperativeLevel/Release are the only legal APIs to be called subsequently any body can help me to solve this problem, thanks David,

Share this post


Link to post
Share on other sites
It sounds like you're trying to reset your device when you're getting D3DERR_DEVICELOST. There doesn't seem to be any problem with the code you posted however, which implies that the error is elsewhere in your code. Try adding some logging statements to your code (Even just OutputDebugString()) to track down exactly when you call Reset().

Share this post


Link to post
Share on other sites
thanks very much

i have struct following:

Win Proc For Window1 and Window2
{
if need reset device
reset device
}

main
{
Create Window 1,
Create Window 2,

// create multi device
CreateDeviceForWindow1(monitor_id);
CreateDeviceForWindow2(monitor_id);
}

CreateNewThread
{
render window1;
{
check for need reset device or not
if need reset device go to WinProc and reset
}
render window2;
}

that is correct?
David,

Share this post


Link to post
Share on other sites
Yes, although for performance reasons you should really avoid using multiple devices (Unless you'r rendering to multiple graphics cards). It's much better to just Present() to a different HWND.

Try adding some logging to see where you call Reset() from; or use the call stack in the debugger if possible (I.e. windowed mode) to see why you're trying to reset the device when it's not ready.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this