//-------------------------------------------------------------------------------------- // Release D3D9 resources created in the OnD3D9CreateDevice callback //-------------------------------------------------------------------------------------- void CALLBACK OnD3D9DestroyDevice( void* pUserContext ) { DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR3, L"Method: OnD3D9DestroyDevice" ); g_DialogResourceManager.OnD3D9DestroyDevice(); g_SettingsDlg.OnD3D9DestroyDevice(); SAFE_RELEASE( g_pEffect9 ); SAFE_RELEASE( g_pFont9 ); SAFE_RELEASE( g_pLightVertDecl ); SAFE_RELEASE( g_pVertDecl ); if( !g_bToggleRefCountBug ) { SAFE_RELEASE( g_pVB ); SAFE_DELETE( g_pVB ); } SAFE_DELETE( g_pEffect9 ); SAFE_DELETE( g_pFont9 ); SAFE_DELETE( g_pLightVertDecl ); SAFE_DELETE( g_pVertDecl ); for( int i = 0; i < NUM_OBJ; ++i ) { g_MeshObj[i].Destroy(); } DXUT_EndPerfEvent(); }
サンプルから引用しただけ。これに従おう。