Jump to content
  • Advertisement
Sign in to follow this  
thuong

reset device error

This topic is 4481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

Share this post


Link to post
Share on other sites
thanks

but i call reset device at the same thread create device and i not create anything(TEXTURE, SURFACE...)

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!