Skip to content

Commit

Permalink
Improve diagnostics for device removed error.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdoeffinger committed Feb 23, 2018
1 parent 795f721 commit 5e3fea6
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion impl11/ddraw/Direct3DTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,36 @@ HRESULT Direct3DTexture::Load(

if (!messageShown)
{
MessageBox(nullptr, _com_error(hr).ErrorMessage(), __FUNCTION__, MB_ICONERROR);
if (hr == DXGI_ERROR_DEVICE_REMOVED)
{
HRESULT reason = this->_deviceResources->_d3dDevice->GetDeviceRemovedReason();
std::ostringstream s;
s << "Direct3D device was removed/driver crashed! Reason given is ";
switch (reason)
{
case DXGI_ERROR_DEVICE_HUNG:
s << "device hung ";
break;
case DXGI_ERROR_DEVICE_REMOVED:
s << "device removed ";
break;
case DXGI_ERROR_DEVICE_RESET:
s << "device reset ";
break;
case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
s << "driver internal error ";
break;
case DXGI_ERROR_INVALID_CALL:
s << "invalid call ";
break;
}
s << reason << " " << _com_error(reason).ErrorMessage();
MessageBox(nullptr, s.str().c_str(), __FUNCTION__, MB_ICONERROR);
}
else
{
MessageBox(nullptr, _com_error(hr).ErrorMessage(), __FUNCTION__, MB_ICONERROR);
}
}

messageShown = true;
Expand Down

0 comments on commit 5e3fea6

Please sign in to comment.