Skip to content

Commit

Permalink
xrRenderR3-R4: Implemented GetDeviceState() for DX10-DX11
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Sep 4, 2018
1 parent aa02792 commit a05bb57
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/Layers/xrRender/r__dsgraph_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,22 +995,31 @@ void D3DXRenderBase::ResourcesDumpMemoryUsage() { Resources->_DumpMemoryUsage();
DeviceState D3DXRenderBase::GetDeviceState()
{
HW.Validate();
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
// TODO: DX10: Implement GetDeviceState
// TODO: DX10: Implement DXGI_PRESENT_TEST testing
// VERIFY(!"D3DXRenderBase::overdrawBegin not implemented.");
#else // USE_DX10
HRESULT _hr = HW.pDevice->TestCooperativeLevel();
if (FAILED(_hr))
#ifdef USE_OGL
// TODO: OGL: Implement GetDeviceState
#elif !defined(USE_DX9)
const auto result = HW.m_pSwapChain->Present(0, DXGI_PRESENT_TEST);

switch (result)
{
// If the device was lost, do not render until we get it back
if (D3DERR_DEVICELOST == _hr)
return DeviceState::Lost;
// Check if the device is ready to be reset
if (D3DERR_DEVICENOTRESET == _hr)
return DeviceState::NeedReset;
// Check if the device is ready to be reset
case DXGI_ERROR_DEVICE_RESET:
return DeviceState::NeedReset;
}
#endif // USE_DX10
#else
const auto result = HW.pDevice->TestCooperativeLevel();

switch (result)
{
// If the device was lost, do not render until we get it back
case D3DERR_DEVICELOST:
return DeviceState::Lost;

// Check if the device is ready to be reset
case D3DERR_DEVICENOTRESET:
return DeviceState::NeedReset;
}
#endif
return DeviceState::Normal;
}

Expand Down

0 comments on commit a05bb57

Please sign in to comment.