Move the call to notify device lost to the Renderer.
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@1855 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libEGL/Display.cpp b/src/libEGL/Display.cpp
index 672491c..f0f0b1b 100644
--- a/src/libEGL/Display.cpp
+++ b/src/libEGL/Display.cpp
@@ -436,7 +436,6 @@
{
(*context)->markContextLost();
}
- mRenderer->markDeviceLost();
error(EGL_CONTEXT_LOST);
}
diff --git a/src/libEGL/Surface.cpp b/src/libEGL/Surface.cpp
index 1aa8288..cb0b9ff 100644
--- a/src/libEGL/Surface.cpp
+++ b/src/libEGL/Surface.cpp
@@ -162,7 +162,7 @@
if (status == EGL_CONTEXT_LOST)
{
- mDisplay->notifyDeviceLost();
+ mRenderer->notifyDeviceLost();
return false;
}
else if (status != EGL_SUCCESS)
@@ -203,7 +203,7 @@
if (status == EGL_CONTEXT_LOST)
{
- mDisplay->notifyDeviceLost();
+ mRenderer->notifyDeviceLost();
return false;
}
else if (status != EGL_SUCCESS)
diff --git a/src/libGLESv2/renderer/Fence9.cpp b/src/libGLESv2/renderer/Fence9.cpp
index 7776a3c..50a42ca 100644
--- a/src/libGLESv2/renderer/Fence9.cpp
+++ b/src/libGLESv2/renderer/Fence9.cpp
@@ -62,9 +62,10 @@
HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
- if (d3d9::checkDeviceLost(result))
+ if (d3d9::isDeviceLostError(result))
{
- return error(GL_OUT_OF_MEMORY, GL_TRUE);
+ mRenderer->notifyDeviceLost();
+ return error(GL_OUT_OF_MEMORY, GL_TRUE);
}
ASSERT(result == S_OK || result == S_FALSE);
@@ -107,9 +108,10 @@
HRESULT result = mQuery->GetData(NULL, 0, 0);
- if (d3d9::checkDeviceLost(result))
+ if (d3d9::isDeviceLostError(result))
{
params[0] = GL_TRUE;
+ mRenderer->notifyDeviceLost();
return error(GL_OUT_OF_MEMORY);
}
diff --git a/src/libGLESv2/renderer/Query9.cpp b/src/libGLESv2/renderer/Query9.cpp
index 86f651b..2904e0e 100644
--- a/src/libGLESv2/renderer/Query9.cpp
+++ b/src/libGLESv2/renderer/Query9.cpp
@@ -108,8 +108,9 @@
ASSERT(false);
}
}
- else if (d3d9::checkDeviceLost(hres))
+ else if (d3d9::isDeviceLostError(hres))
{
+ mRenderer->notifyDeviceLost();
return error(GL_OUT_OF_MEMORY, GL_TRUE);
}
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index 85e8bc0..2d4b961 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -133,7 +133,7 @@
virtual void markAllStateDirty() = 0;
// lost device
- virtual void markDeviceLost() = 0;
+ virtual void notifyDeviceLost() = 0;
virtual bool isDeviceLost() = 0;
virtual bool testDeviceLost(bool notify) = 0;
virtual bool testDeviceResettable() = 0;
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index 2088ac2..09889f4 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -1759,9 +1759,10 @@
}
}
-void Renderer11::markDeviceLost()
+void Renderer11::notifyDeviceLost()
{
mDeviceLost = true;
+ mDisplay->notifyDeviceLost();
}
bool Renderer11::isDeviceLost()
@@ -1780,14 +1781,12 @@
if (isLost)
{
// ensure we note the device loss --
- // we'll probably get this done again by markDeviceLost
- // but best to remember it!
// Note that we don't want to clear the device loss status here
// -- this needs to be done by resetDevice
mDeviceLost = true;
if (notify)
{
- mDisplay->notifyDeviceLost();
+ notifyDeviceLost();
}
}
diff --git a/src/libGLESv2/renderer/Renderer11.h b/src/libGLESv2/renderer/Renderer11.h
index 373f118..8642958 100644
--- a/src/libGLESv2/renderer/Renderer11.h
+++ b/src/libGLESv2/renderer/Renderer11.h
@@ -85,7 +85,7 @@
virtual void markAllStateDirty();
// lost device
- virtual void markDeviceLost();
+ void notifyDeviceLost();
virtual bool isDeviceLost();
virtual bool testDeviceLost(bool notify);
virtual bool testDeviceResettable();
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index 2e7d3ec..930a15d 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -636,7 +636,7 @@
if (d3d9::isDeviceLostError(result))
{
- mDisplay->notifyDeviceLost();
+ notifyDeviceLost();
}
}
@@ -2016,9 +2016,10 @@
}
-void Renderer9::markDeviceLost()
+void Renderer9::notifyDeviceLost()
{
mDeviceLost = true;
+ mDisplay->notifyDeviceLost();
}
bool Renderer9::isDeviceLost()
@@ -2047,14 +2048,12 @@
if (isLost)
{
// ensure we note the device loss --
- // we'll probably get this done again by markDeviceLost
- // but best to remember it!
// Note that we don't want to clear the device loss status here
// -- this needs to be done by resetDevice
mDeviceLost = true;
if (notify)
{
- mDisplay->notifyDeviceLost();
+ notifyDeviceLost();
}
}
@@ -2705,8 +2704,11 @@
// It turns out that D3D will sometimes produce more error
// codes than those documented.
- if (d3d9::checkDeviceLost(result))
+ if (d3d9::isDeviceLostError(result))
+ {
+ notifyDeviceLost();
return error(GL_OUT_OF_MEMORY);
+ }
else
{
UNREACHABLE();
diff --git a/src/libGLESv2/renderer/Renderer9.h b/src/libGLESv2/renderer/Renderer9.h
index 74e383c..9282029 100644
--- a/src/libGLESv2/renderer/Renderer9.h
+++ b/src/libGLESv2/renderer/Renderer9.h
@@ -113,7 +113,7 @@
virtual void markAllStateDirty();
// lost device
- virtual void markDeviceLost();
+ void notifyDeviceLost();
virtual bool isDeviceLost();
virtual bool testDeviceLost(bool notify);
virtual bool testDeviceResettable();
diff --git a/src/libGLESv2/renderer/renderer9_utils.h b/src/libGLESv2/renderer/renderer9_utils.h
index fbff5f6..5b76972 100644
--- a/src/libGLESv2/renderer/renderer9_utils.h
+++ b/src/libGLESv2/renderer/renderer9_utils.h
@@ -75,19 +75,6 @@
}
}
-inline bool checkDeviceLost(HRESULT errorCode)
-{
- egl::Display *display = NULL;
-
- if (isDeviceLostError(errorCode))
- {
- display = gl::getDisplay();
- display->notifyDeviceLost();
- return true;
- }
- return false;
-};
-
}
#endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H