Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualcozzie

Posted 25 December 2012 - 11:04 AM

Hi, I'm struggling with implementating lost device catching in combination with alt+tab not working when in debug mode only (working in retail mode). I catch a possible D3DERR_DEVICELOST exception from the 'Present' call in my render function, setting mDeviceLost to true. Here's the code of my WM_ACTIVATE situation (windowproc);

case WM_ACTIVATE: if(LOWORD(wParam) == WA_INACTIVE) { active = false; } else { if(_d3d.mDeviceLost) { if(_d3d.mD3ddev->TestCooperativeLevel() != D3D_OK) { _d3d.ResetDevice(); _d3d.LoadScene(&_scene, &_d3dscene, &_d3dcam); } // Sleep(10); // while(true) // { // HRESULT hr = _d3d.mD3ddev->TestCooperativeLevel(); // if(hr == D3DERR_DEVICENOTRESET) _d3d.ResetDevice(); // if(hr == D3DERR_DRIVERINTERNALERROR) PostQuitMessage(WM_QUIT); // if(hr == D3D_OK) // { // _d3d.LoadScene(&_scene, &_d3dscene, &_d3dcam); // active = true; // break; // } // } } active = true; } break;
The active code is working when in retail mode (not debug), the code now marked as comment is not working (which I would expect). During startup in fullscreen, I also see the following error in my d3d debug (might be causing that alt+tab doesn't work in debug, only in retail mode): Direct3D9: :StartExclusiveMode Direct3D9: :WM_DISPLAYCHANGE: 1600x900x32 Direct3D9: (ERROR) :Lost due to display uniqueness change Any help is appreciated, maybe both questions are strongly related..


#1cozzie

Posted 07 December 2012 - 03:01 PM

Hi,
I'm struggling with implementating lost device catching in combination with alt+tab not working when in debug mode only (working in retail mode).

I catch a possible D3DERR_DEVICELOST exception from the 'Present' call in my render function, setting mDeviceLost to true.
Here's the code of my WM_ACTIVATE situation (windowproc);

[source lang="cpp"]  case WM_ACTIVATE:   if(LOWORD(wParam) == WA_INACTIVE)    { active = false;   }   else   { if(_d3d.mDeviceLost) { if(_d3d.mD3ddev->TestCooperativeLevel() != D3D_OK) {   _d3d.ResetDevice();   _d3d.LoadScene(&_scene, &_d3dscene, &_d3dcam); } // Sleep(10);// while(true)// {//   HRESULT hr = _d3d.mD3ddev->TestCooperativeLevel();//   if(hr == D3DERR_DEVICENOTRESET) _d3d.ResetDevice();//   if(hr == D3DERR_DRIVERINTERNALERROR) PostQuitMessage(WM_QUIT);//   if(hr == D3D_OK)//   {//    _d3d.LoadScene(&_scene, &_d3dscene, &_d3dcam);//    active = true;//    break;//   }// } } active = true;   }   break; [/source]

The active code is working when in retail mode (not debug), the code now marked as comment is not working (which I would expect).

During startup in fullscreen, I also see the following error in my d3d debug (might be causing that alt+tab doesn't work in debug, only in retail mode):
Direct3D9: :StartExclusiveMode
Direct3D9: :WM_DISPLAYCHANGE: 1600x900x32
Direct3D9: (ERROR) :Lost due to display uniqueness change

Any help is appreciated, maybe both questions are strongly related..

PARTNERS