Commit 4c76feac by Jamie Madill

Remove notify parameter from testDeviceLost.

We can get rid of this parameter now that we call notify directly on the display in cases where we need to. BUG=angle:795 Change-Id: I2024b70d0d725e755f7aa742ba221c2d0179d8b6 Reviewed-on: https://chromium-review.googlesource.com/228911Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 9dd0cf0a
......@@ -1387,7 +1387,7 @@ GLenum Context::getResetStatus()
{
// mResetStatus will be set by the markContextLost callback
// in the case a notification is sent
if (mRenderer->testDeviceLost(false))
if (mRenderer->testDeviceLost())
{
mRenderer->notifyDeviceLost();
}
......
......@@ -363,7 +363,7 @@ Error Display::createWindowSurface(EGLNativeWindowType window, EGLConfig config,
return Error(EGL_BAD_ALLOC);
}
if (mRenderer->testDeviceLost(false))
if (mRenderer->testDeviceLost())
{
Error error = restoreLostDevice();
if (error.isError())
......@@ -480,7 +480,7 @@ Error Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle, cons
return Error(EGL_BAD_ATTRIBUTE);
}
if (mRenderer->testDeviceLost(false))
if (mRenderer->testDeviceLost())
{
Error error = restoreLostDevice();
if (error.isError())
......@@ -513,7 +513,7 @@ Error Display::createContext(EGLConfig configHandle, EGLint clientVersion, const
*outContext = EGL_NO_CONTEXT;
return Error(EGL_SUCCESS);
}
else if (mRenderer->testDeviceLost(false)) // Lost device
else if (mRenderer->testDeviceLost()) // Lost device
{
Error error = restoreLostDevice();
if (error.isError())
......
......@@ -185,7 +185,9 @@ Error Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if (status == EGL_CONTEXT_LOST)
{
mRenderer->notifyDeviceLost();
//TODO(jmadill): MANGLE refactor
rx::RendererD3D *rendererD3D = static_cast<rx::RendererD3D*>(mRenderer);
rendererD3D->notifyDeviceLost();
return Error(status);
}
else if (status != EGL_SUCCESS)
......@@ -226,7 +228,9 @@ Error Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
if (status == EGL_CONTEXT_LOST)
{
mRenderer->notifyDeviceLost();
//TODO(jmadill): MANGLE refactor
rx::RendererD3D *rendererD3D = static_cast<rx::RendererD3D*>(mRenderer);
rendererD3D->notifyDeviceLost();
return Error(status);
}
else if (status != EGL_SUCCESS)
......
......@@ -141,7 +141,7 @@ class Renderer
//TODO(jmadill): investigate if this stuff is necessary in GL
virtual void notifyDeviceLost() = 0;
virtual bool isDeviceLost() = 0;
virtual bool testDeviceLost(bool notify) = 0;
virtual bool testDeviceLost() = 0;
virtual bool testDeviceResettable() = 0;
virtual DWORD getAdapterVendor() const = 0;
......
......@@ -144,7 +144,7 @@ gl::Error Query11::testQuery()
break;
}
if (!mQueryFinished && mRenderer->testDeviceLost(false))
if (!mQueryFinished && mRenderer->testDeviceLost())
{
mRenderer->notifyDeviceLost();
return gl::Error(GL_OUT_OF_MEMORY, "Failed to test get query result, device is lost.");
......
......@@ -505,7 +505,7 @@ gl::Error Renderer11::sync(bool block)
// Keep polling, but allow other threads to do something useful first
ScheduleYield();
if (testDeviceLost(false))
if (testDeviceLost())
{
mDisplay->notifyDeviceLost();
return gl::Error(GL_OUT_OF_MEMORY, "Device was lost while waiting for sync.");
......@@ -1830,7 +1830,7 @@ bool Renderer11::isDeviceLost()
}
// set notify to true to broadcast a message to all contexts of the device loss
bool Renderer11::testDeviceLost(bool notify)
bool Renderer11::testDeviceLost()
{
bool isLost = false;
......@@ -1852,10 +1852,6 @@ bool Renderer11::testDeviceLost(bool notify)
// Note that we don't want to clear the device loss status here
// -- this needs to be done by resetDevice
mDeviceLost = true;
if (notify)
{
notifyDeviceLost();
}
}
return isLost;
......
......@@ -101,7 +101,7 @@ class Renderer11 : public RendererD3D
// lost device
void notifyDeviceLost() override;
bool isDeviceLost() override;
bool testDeviceLost(bool notify) override;
bool testDeviceLost() override;
bool testDeviceResettable() override;
DWORD getAdapterVendor() const override;
......
......@@ -131,7 +131,7 @@ gl::Error Query9::testQuery()
mRenderer->notifyDeviceLost();
return gl::Error(GL_OUT_OF_MEMORY, "Failed to test get query result, device is lost.");
}
else if (mRenderer->testDeviceLost(false))
else if (mRenderer->testDeviceLost())
{
mRenderer->notifyDeviceLost();
return gl::Error(GL_OUT_OF_MEMORY, "Failed to test get query result, device is lost.");
......
......@@ -143,7 +143,7 @@ Renderer9::~Renderer9()
if (mDevice)
{
// If the device is lost, reset it first to prevent leaving the driver in an unstable state
if (testDeviceLost(false))
if (testDeviceLost())
{
resetDevice();
}
......@@ -531,7 +531,7 @@ gl::Error Renderer9::sync(bool block)
// explicitly check for device loss
// some drivers seem to return S_FALSE even if the device is lost
// instead of D3DERR_DEVICELOST like they should
if (result == S_FALSE && testDeviceLost(false))
if (result == S_FALSE && testDeviceLost())
{
result = D3DERR_DEVICELOST;
}
......@@ -2163,7 +2163,7 @@ bool Renderer9::isDeviceLost()
}
// set notify to true to broadcast a message to all contexts of the device loss
bool Renderer9::testDeviceLost(bool notify)
bool Renderer9::testDeviceLost()
{
HRESULT status = getDeviceStatusCode();
bool isLost = FAILED(status);
......@@ -2176,10 +2176,6 @@ bool Renderer9::testDeviceLost(bool notify)
// Note that we don't want to clear the device loss status here
// -- this needs to be done by resetDevice
mDeviceLost = true;
if (notify)
{
notifyDeviceLost();
}
}
return isLost;
......@@ -2227,7 +2223,7 @@ bool Renderer9::resetDevice()
D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
HRESULT result = D3D_OK;
bool lost = testDeviceLost(false);
bool lost = testDeviceLost();
bool removedDevice = (getDeviceStatusCode() == D3DERR_DEVICEREMOVED);
// Device Removed is a feature which is only present with D3D9Ex
......@@ -2247,7 +2243,7 @@ bool Renderer9::resetDevice()
{
Sleep(500); // Give the graphics driver some CPU time
result = mDeviceEx->ResetEx(&presentParameters, NULL);
lost = testDeviceLost(false);
lost = testDeviceLost();
}
else
{
......@@ -2262,7 +2258,7 @@ bool Renderer9::resetDevice()
{
result = mDevice->Reset(&presentParameters);
}
lost = testDeviceLost(false);
lost = testDeviceLost();
}
}
......
......@@ -102,7 +102,7 @@ class Renderer9 : public RendererD3D
// lost device
void notifyDeviceLost() override;
bool isDeviceLost() override;
bool testDeviceLost(bool notify) override;
bool testDeviceLost() override;
bool testDeviceResettable() override;
DWORD getAdapterVendor() const override;
......
......@@ -989,7 +989,7 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
if (dpy != EGL_NO_DISPLAY && display->isInitialized())
{
rx::Renderer *renderer = display->getRenderer();
if (renderer->testDeviceLost(false))
if (renderer->testDeviceLost())
{
display->notifyDeviceLost();
return EGL_FALSE;
......
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