| 77 | } |
| 78 | |
| 79 | void BaseManager::drawOneFrame() |
| 80 | { |
| 81 | if (mIsDeviceLost) |
| 82 | { |
| 83 | Sleep(100); |
| 84 | |
| 85 | HRESULT hr; |
| 86 | if (FAILED(hr = mDevice->TestCooperativeLevel())) |
| 87 | { |
| 88 | if (hr == D3DERR_DEVICELOST) |
| 89 | return; |
| 90 | |
| 91 | if (hr == D3DERR_DEVICENOTRESET) |
| 92 | { |
| 93 | if (mPlatform != nullptr) |
| 94 | mPlatform->getRenderManagerPtr()->deviceLost(); |
| 95 | |
| 96 | hr = mDevice->Reset(&mD3dpp); |
| 97 | |
| 98 | if (FAILED(hr)) |
| 99 | return; |
| 100 | |
| 101 | if (mPlatform != nullptr) |
| 102 | mPlatform->getRenderManagerPtr()->deviceRestore(); |
| 103 | } |
| 104 | |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | mIsDeviceLost = false; |
| 109 | } |
| 110 | |
| 111 | if (SUCCEEDED(mDevice->BeginScene())) |
| 112 | { |
| 113 | mDevice->Clear(0, nullptr, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x001589FF, 1.0f, 0); |
| 114 | mPlatform->getRenderManagerPtr()->drawOneFrame(); |
| 115 | mDevice->EndScene(); |
| 116 | } |
| 117 | |
| 118 | if (mDevice->Present(nullptr, nullptr, 0, nullptr) == D3DERR_DEVICELOST) |
| 119 | mIsDeviceLost = true; |
| 120 | } |
| 121 | |
| 122 | void BaseManager::resizeRender(int _width, int _height) |
| 123 | { |
nothing calls this directly
no test coverage detected