Add the ability to recover from a removed device (TDR or driver removal) to the D3D11 code path.
TRAC #22411
Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
Author: Jamie Madill
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1857 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/Image11.cpp b/src/libGLESv2/renderer/Image11.cpp
index 41dc670..df9965b 100644
--- a/src/libGLESv2/renderer/Image11.cpp
+++ b/src/libGLESv2/renderer/Image11.cpp
@@ -401,15 +401,22 @@
{
createStagingTexture();
- HRESULT result = D3DERR_INVALIDCALL;
+ HRESULT result = E_FAIL;
if (mStagingTexture)
{
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
result = deviceContext->Map(mStagingTexture, 0, D3D11_MAP_WRITE, 0, map);
- ASSERT(SUCCEEDED(result));
- mDirty = true;
+ // this can fail if the device is removed (from TDR)
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ }
+ else if (SUCCEEDED(result))
+ {
+ mDirty = true;
+ }
}
return result;