Handle DEVICE_REMOVED

- Added DXGI_ERROR_DEVICE_REMOVED handling in dxRenderCommand::SwapBuffers
This commit is contained in:
Light 2021-06-21 17:04:51 +04:30
parent f9f0d8b649
commit 0fc1896854

View file

@ -16,7 +16,20 @@ namespace Light {
void dxRenderCommand::SwapBuffers()
{
m_Context->swapChain->Present(0, 0);
#ifdef LIGHT_DEBUG
HRESULT hr;
if (FAILED(hr = m_Context->swapChain->Present(0u, 0u)))
{
if (hr == DXGI_ERROR_DEVICE_REMOVED)
{
LT_ENGINE_CRITICAL("dxRenderCommand::SwapBuffers: DeviceRemoved:");
LT_ENGINE_CRITICAL(" {}", m_Context->device->GetDeviceRemovedReason());
}
}
#else
m_Context->swapChain->Present(0u, 0u);
#endif
}
void dxRenderCommand::ClearBackBuffer()