Report an EGL_CONTEXT_LOST error on D3DERR_DEVICELOST

Trac #11233 Signed-off-by: Shannon Woods Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@311 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a2a95e7c
......@@ -221,7 +221,7 @@ void Surface::restoreState(IDirect3DDevice9 *device)
}
}
void Surface::swap()
bool Surface::swap()
{
if (mSwapChain)
{
......@@ -253,9 +253,18 @@ void Surface::swap()
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
{
return error(EGL_BAD_ALLOC);
return error(EGL_BAD_ALLOC, false);
}
if (result == D3DERR_DEVICELOST)
{
return error(EGL_CONTEXT_LOST, false);
}
ASSERT(SUCCEEDED(result));
}
return true;
}
EGLint Surface::getWidth() const
......
......@@ -30,7 +30,7 @@ class Surface
~Surface();
HWND getWindowHandle();
void swap();
bool swap();
virtual EGLint getWidth() const;
virtual EGLint getHeight() const;
......
......@@ -823,6 +823,13 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
{
egl::Display *display = static_cast<egl::Display*>(dpy);
gl::Context *context = static_cast<gl::Context*>(ctx);
IDirect3DDevice9 *device = display->getDevice();
DWORD passes;
if (!device || device->ValidateDevice(&passes) == D3DERR_DEVICELOST)
{
return error(EGL_CONTEXT_LOST, false);
}
if (ctx != EGL_NO_CONTEXT && !validate(display, context))
{
......@@ -987,9 +994,11 @@ EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
}
egl::Surface *eglSurface = (egl::Surface*)surface;
eglSurface->swap();
return success(EGL_TRUE);
if (eglSurface->swap())
{
return success(EGL_TRUE);
}
}
catch(std::bad_alloc&)
{
......
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