| 271 | } |
| 272 | |
| 273 | void |
| 274 | DeviceManager::Shutdown() |
| 275 | { |
| 276 | if(m_SwapChain && GetWindowState() == kWindowFullscreen) |
| 277 | m_SwapChain->SetFullscreenState(false, NULL); |
| 278 | |
| 279 | DeviceDestroyed(); |
| 280 | |
| 281 | SAFE_RELEASE(m_BackBufferRTV); |
| 282 | SAFE_RELEASE(m_DepthStencilDSV); |
| 283 | SAFE_RELEASE(m_DepthStencilBuffer); |
| 284 | |
| 285 | g_DeviceManagerInstance = NULL; |
| 286 | SAFE_RELEASE(m_ImmediateContext); |
| 287 | SAFE_RELEASE(m_SwapChain); |
| 288 | |
| 289 | ID3D11Debug * d3dDebug = nullptr; |
| 290 | if (nullptr != m_Device) |
| 291 | { |
| 292 | ID3D11DeviceContext* pCtx; |
| 293 | m_Device->GetImmediateContext(&pCtx); |
| 294 | pCtx->ClearState(); |
| 295 | pCtx->Flush(); |
| 296 | pCtx->Release(); |
| 297 | if (SUCCEEDED(m_Device->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void**>(&d3dDebug)))) |
| 298 | { |
| 299 | d3dDebug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); |
| 300 | d3dDebug->Release(); |
| 301 | } |
| 302 | } |
| 303 | SAFE_RELEASE(m_Device); |
| 304 | |
| 305 | if(m_hWnd) |
| 306 | { |
| 307 | DestroyWindow(m_hWnd); |
| 308 | m_hWnd = NULL; |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | HRESULT |
| 313 | DeviceManager::CreateRenderTargetAndDepthStencil() |