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