reset device error

Started by
4 comments, last by Evil Steve 18 years, 1 month ago
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,
Advertisement
I'm taking this from msdn, but it seems that:

A call to Reset will fail if called on a different thread than that used to create the device being reset.


Also, look at MSDN for more info.
thanks

but i call reset device at the same thread create device and i not create anything(TEXTURE, SURFACE...)
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().
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,
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.

This topic is closed to new replies.

Advertisement