   Problem with D3D_FEATURE_LEVEL_ and D3D9 Callbacks in DX11
  I had a problem when using D3D_FEATURE_LEVEL_ and D3D9  Callbacks in DX11.DXUT framework jumps into the following Callbacs when the app window is resized   (1) DXUTSetCallbackDeviceChanging( OnD3DModify..)   (2) DXUTSetCallbackD3D9DeviceLost( OnD3dlost..)   (3) DXUTSetCallbackD3D9DeviceDestroyed( OnD3D9Destroy..)   (4) DXUTSetCallbackD3D9DeviceCreated( OnD3D9Create..)   (5)DXUTSetCallbackD3D9DeviceReset( OnD3D9Reset..)It's not nesesary to destroy and remove (3) the bitmaps, meshes, effects and so on and then reload/recompile (4) them again every time the app-window is resized . It should be like this   (1) DXUTSetCallbackDeviceChanging( OnD3DModify..)   (2) DXUTSetCallbackD3D9DeviceLost( OnD3dlost..)   (3) ignore   (4) ignore   (5) DXUTSetCallbackD3D9DeviceReset( OnD3D9Reset..) This prevent the app reloading all the geometry, textures and effects for every WM_RESIZE.I then had a look in DXUT.cpp and found that some code is missing in function the DXUTChangeDevice(....\DXUT11\Core\DXUT.cpp// INSERTED missing function  DXUTCanDeviceBeReset... here// Check if the new device is close enough to the old device to simply reset or // resize the back bufferbool DXUTCanDeviceBeReset( DXUTDeviceSettings* pOldDeviceSettings, DXUTDeviceSettings* pNewDeviceSettings,  IDirect3DDevice9* pd3d9DeviceFromApp, ID3D11Device* pd3d11DeviceFromApp ){    if( pOldDeviceSettings == NULL || pOldDeviceSettings-&gt;ver != pNewDeviceSettings-&gt;ver )   return false;    if( pNewDeviceSettings-&gt;ver == DXUT_D3D9_DEVICE )    {   if( DXUTGetD3D9Device() &&  ( pd3d9DeviceFromApp == NULL || pd3d9DeviceFromApp == DXUTGetD3D9Device() ) &&  ( pOldDeviceSettings-&gt;d3d9.AdapterOrdinal == pNewDeviceSettings-&gt;d3d9.AdapterOrdinal ) &&  ( pOldDeviceSettings-&gt;d3d9.DeviceType == pNewDeviceSettings-&gt;d3d9.DeviceType ) &&  ( pOldDeviceSettings-&gt;d3d9.BehaviorFlags == pNewDeviceSettings-&gt;d3d9.BehaviorFlags ) )  return true;   return false;    }    else    {   if( DXUTGetD3D11Device() &&  ( pd3d11DeviceFromApp == NULL || pd3d11DeviceFromApp == DXUTGetD3D11Device() ) &&  ( pOldDeviceSettings-&gt;d3d11.AdapterOrdinal == pNewDeviceSettings-&gt;d3d11.AdapterOrdinal ) &&  ( pOldDeviceSettings-&gt;d3d11.DriverType == pNewDeviceSettings-&gt;d3d11.DriverType ) &&  ( pOldDeviceSettings-&gt;d3d11.CreateFlags == pNewDeviceSettings-&gt;d3d11.CreateFlags ) &&  ( pOldDeviceSettings-&gt;d3d11.sd.SampleDesc.Count == pNewDeviceSettings-&gt;d3d11.sd.SampleDesc.Count ) &&  ( pOldDeviceSettings-&gt;d3d11.sd.SampleDesc.Quality == pNewDeviceSettings-&gt;d3d11.sd.SampleDesc.Quality ) )  return true;   return false;    }}//end insertion -------------------------------------------------------------------------------------------------------------------HRESULT DXUTChangeDevice( DXUTDeviceSettings* pNewDeviceSettings, IDirect3DDevice9* pd3d9DeviceFromApp,  ID3D11Device* pd3d11DeviceFromApp, bool bForceRecreate, bool bClipWindowToSingleAdapter )... else   {  // Going to fullscreen mode  if( pOldDeviceSettings == NULL || ( pOldDeviceSettings && DXUTGetIsWindowedFromDS( pOldDeviceSettings ) ) )  { // Transistioning to full screen mode from a standard window so  if( pOldDeviceSettings ) {GetDXUTState().SetWindowBackBufferWidthAtModeChange( DXUTGetBackBufferWidthFromDS(   pOldDeviceSettings ) );GetDXUTState().SetWindowBackBufferHeightAtModeChange( DXUTGetBackBufferHeightFromDS(    pOldDeviceSettings ) ); }  }   }    }// inserted this code here.//------------------------------------------------------------------------------------------------------------------------------------------    if( !bForceRecreate && DXUTCanDeviceBeReset( pOldDeviceSettings, pNewDeviceSettings, pd3d9DeviceFromApp, pd3d11DeviceFromApp ) )    {   // Reset the Direct3D device and call the app's device callbacks   if( DXUTIsD3D9( pOldDeviceSettings ) )  hr = DXUTReset3DEnvironment9();   else  hr = DXUTReset3DEnvironment11();   if( FAILED( hr ) )   {  if( D3DERR_DEVICELOST == hr )  { // The device is lost, just mark it as so and continue on with  // capturing the state and resizing the window/etc. GetDXUTState().SetDeviceLost( true );  }  else if( DXUTERR_RESETTINGDEVICEOBJECTS == hr || DXUTERR_MEDIANOTFOUND == hr )  { // Something bad happened in the app callbacks SAFE_DELETE( pOldDeviceSettings ); DXUTDisplayErrorMessage( hr ); DXUTShutdown(); return hr;  }  else // DXUTERR_RESETTINGDEVICE  { // Reset failed and the device wasn't lost and it wasn't the apps fault,  // so recreate the device to try to recover GetDXUTState().SetCurrentDeviceSettings( pOldDeviceSettings ); if( FAILED( DXUTChangeDevice( pNewDeviceSettings, pd3d9DeviceFromApp, pd3d11DeviceFromApp, true, bClipWindowToSingleAdapter ) ) ) {// If that fails, then shutdownDXUTShutdown();return DXUTERR_CREATINGDEVICE; } else {DXUTPause( false, false );return S_OK; }  }   }    }    else    {// end if insertion----------------------------------------------------------------------------------------------------- if( pOldDeviceSettings )   DXUTCleanup3DEnvironment( false );    // Create the D3D device and call the app's device callbacks    if( DXUTIsD3D9( pNewDeviceSettings ) ) {   hr = DXUTCreate3DEnvironment9( pd3d9DeviceFromApp );    }    else {   hr = DXUTCreate3DEnvironment11( pd3d11DeviceFromApp );    }    if( FAILED( hr ) )    {   SAFE_DELETE( pOldDeviceSettings );   DXUTCleanup3DEnvironment( true );   DXUTDisplayErrorMessage( hr );   DXUTPause( false, false );   GetDXUTState().SetIgnoreSizeChange( false );   return hr;    } } // and inserted this one-------------------------------------------------------------------------------------------------------    // Enable/disable StickKeys shortcut, ToggleKeys shortcut, FilterKeys shortcut, and Windows key// to prevent accidental task switching    DXUTAllowShortcutKeys( ( DXUTGetIsWindowedFromDS( pNewDeviceSettings ) ) ?  GetDXUTState().GetAllowShortcutKeysWhenWindowed() :  GetDXUTState().GetAllowShortcutKeysWhenFullscreen() );[Edited by - Evil Steve on April 20, 2010 9:57:44 AM]
  Please give your posts meaningful titles and use [ source ] tags. I've modified your post accordingly.Is there an issue you still have, or is this just information?   ;  Well, thank you for the modifying.I dont now about the [ source ] tags and how to use them.Just wanted to tell about the missing code in DXUT.After I inserted the code into DXUT.cpp it works perfectly.No issue anymore. If you check your own DXUT11\core\DXUT.cpp you might be surprised at the missing lines of code, compare it with the DXUT.cpp in dx10and it becomes quite clear that the MS guys forgot to do some copy pasting. 