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
parent f5f59491
......@@ -436,7 +436,6 @@ void Display::notifyDeviceLost()
{
(*context)->markContextLost();
}
mRenderer->markDeviceLost();
error(EGL_CONTEXT_LOST);
}
......
......@@ -162,7 +162,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if (status == EGL_CONTEXT_LOST)
{
mDisplay->notifyDeviceLost();
mRenderer->notifyDeviceLost();
return false;
}
else if (status != EGL_SUCCESS)
......@@ -203,7 +203,7 @@ bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
if (status == EGL_CONTEXT_LOST)
{
mDisplay->notifyDeviceLost();
mRenderer->notifyDeviceLost();
return false;
}
else if (status != EGL_SUCCESS)
......
......@@ -62,9 +62,10 @@ GLboolean Fence9::testFence()
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 @@ void Fence9::getFenceiv(GLenum pname, GLint *params)
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);
}
......
......@@ -108,8 +108,9 @@ GLboolean Query9::testQuery()
ASSERT(false);
}
}
else if (d3d9::checkDeviceLost(hres))
else if (d3d9::isDeviceLostError(hres))
{
mRenderer->notifyDeviceLost();
return error(GL_OUT_OF_MEMORY, GL_TRUE);
}
......
......@@ -133,7 +133,7 @@ class Renderer
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;
......
......@@ -1759,9 +1759,10 @@ void Renderer11::releaseDeviceResources()
}
}
void Renderer11::markDeviceLost()
void Renderer11::notifyDeviceLost()
{
mDeviceLost = true;
mDisplay->notifyDeviceLost();
}
bool Renderer11::isDeviceLost()
......@@ -1780,14 +1781,12 @@ bool Renderer11::testDeviceLost(bool notify)
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();
}
}
......
......@@ -85,7 +85,7 @@ class Renderer11 : public Renderer
virtual void markAllStateDirty();
// lost device
virtual void markDeviceLost();
void notifyDeviceLost();
virtual bool isDeviceLost();
virtual bool testDeviceLost(bool notify);
virtual bool testDeviceResettable();
......
......@@ -636,7 +636,7 @@ void Renderer9::sync(bool block)
if (d3d9::isDeviceLostError(result))
{
mDisplay->notifyDeviceLost();
notifyDeviceLost();
}
}
......@@ -2016,9 +2016,10 @@ void Renderer9::releaseDeviceResources()
}
void Renderer9::markDeviceLost()
void Renderer9::notifyDeviceLost()
{
mDeviceLost = true;
mDisplay->notifyDeviceLost();
}
bool Renderer9::isDeviceLost()
......@@ -2047,14 +2048,12 @@ bool Renderer9::testDeviceLost(bool notify)
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 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
// 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();
......
......@@ -113,7 +113,7 @@ class Renderer9 : public Renderer
virtual void markAllStateDirty();
// lost device
virtual void markDeviceLost();
void notifyDeviceLost();
virtual bool isDeviceLost();
virtual bool testDeviceLost(bool notify);
virtual bool testDeviceResettable();
......
......@@ -75,19 +75,6 @@ inline bool isDeviceLostError(HRESULT errorCode)
}
}
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment