Check for all device lost errors.

TRAC #18606 Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@844 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 78d44868
...@@ -255,7 +255,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight) ...@@ -255,7 +255,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result); ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
release(); release();
if(result == D3DERR_DEVICELOST) if(isDeviceLostError(result))
{ {
return error(EGL_CONTEXT_LOST, false); return error(EGL_CONTEXT_LOST, false);
} }
...@@ -421,12 +421,12 @@ bool Surface::swap() ...@@ -421,12 +421,12 @@ bool Surface::swap()
HRESULT result = mSwapChain->Present(NULL, NULL, NULL, NULL, 0); HRESULT result = mSwapChain->Present(NULL, NULL, NULL, NULL, 0);
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR) if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
{ {
return error(EGL_BAD_ALLOC, false); return error(EGL_BAD_ALLOC, false);
} }
if (result == D3DERR_DEVICELOST || result == D3DERR_DEVICEHUNG || result == D3DERR_DEVICEREMOVED) if (isDeviceLostError(result))
{ {
return error(EGL_CONTEXT_LOST, false); return error(EGL_CONTEXT_LOST, false);
} }
......
...@@ -2229,18 +2229,16 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum ...@@ -2229,18 +2229,16 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
{ {
systemSurface->Release(); systemSurface->Release();
switch (result) // It turns out that D3D will sometimes produce more error
{ // codes than those documented.
// It turns out that D3D will sometimes produce more error if (checkDeviceLost(result))
// codes than those documented.
case D3DERR_DRIVERINTERNALERROR:
case D3DERR_DEVICELOST:
case D3DERR_DEVICEHUNG:
return error(GL_OUT_OF_MEMORY); return error(GL_OUT_OF_MEMORY);
default: else
{
UNREACHABLE(); UNREACHABLE();
return; // No sensible error to generate return;
} }
} }
D3DLOCKED_RECT lock; D3DLOCKED_RECT lock;
...@@ -2826,7 +2824,7 @@ void Context::sync(bool block) ...@@ -2826,7 +2824,7 @@ void Context::sync(bool block)
eventQuery->Release(); eventQuery->Release();
if (result == D3DERR_DEVICELOST) if (checkDeviceLost(result))
{ {
error(GL_OUT_OF_MEMORY); error(GL_OUT_OF_MEMORY);
} }
......
...@@ -65,7 +65,7 @@ GLboolean Fence::testFence() ...@@ -65,7 +65,7 @@ GLboolean Fence::testFence()
HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH); HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
if (result == D3DERR_DEVICELOST) if (checkDeviceLost(result))
{ {
return error(GL_OUT_OF_MEMORY, GL_TRUE); return error(GL_OUT_OF_MEMORY, GL_TRUE);
} }
...@@ -110,7 +110,7 @@ void Fence::getFenceiv(GLenum pname, GLint *params) ...@@ -110,7 +110,7 @@ void Fence::getFenceiv(GLenum pname, GLint *params)
HRESULT result = mQuery->GetData(NULL, 0, 0); HRESULT result = mQuery->GetData(NULL, 0, 0);
if (result == D3DERR_DEVICELOST) if (checkDeviceLost(result))
{ {
params[0] = GL_TRUE; params[0] = GL_TRUE;
return error(GL_OUT_OF_MEMORY); return error(GL_OUT_OF_MEMORY);
......
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