Commit 1a2cd269 by kbr@chromium.org

Changed two assertions to explicit tests, and added an error code to

those checked during ReadPixels. These changes are needed to avoid having ANGLE assert in debug builds when running WebGL test cases which provoke a GPU reset. BUG=none TEST=slow-shader-example and lots-of-polys-example in WebGL test suite Review URL: http://codereview.appspot.com/4684042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@703 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent b0eb6978
...@@ -297,8 +297,11 @@ void Display::startScene() ...@@ -297,8 +297,11 @@ void Display::startScene()
if (!mSceneStarted) if (!mSceneStarted)
{ {
long result = mDevice->BeginScene(); long result = mDevice->BeginScene();
ASSERT(SUCCEEDED(result)); if (SUCCEEDED(result)) {
mSceneStarted = true; // This is defensive checking against the device being
// lost at unexpected times.
mSceneStarted = true;
}
} }
} }
...@@ -306,8 +309,9 @@ void Display::endScene() ...@@ -306,8 +309,9 @@ void Display::endScene()
{ {
if (mSceneStarted) if (mSceneStarted)
{ {
long result = mDevice->EndScene(); // EndScene can fail if the device was lost, for example due
ASSERT(SUCCEEDED(result)); // to a TDR during a draw call.
mDevice->EndScene();
mSceneStarted = false; mSceneStarted = false;
} }
} }
......
...@@ -2158,8 +2158,11 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum ...@@ -2158,8 +2158,11 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
switch (result) switch (result)
{ {
// It turns out that D3D will sometimes produce more error
// codes than those documented.
case D3DERR_DRIVERINTERNALERROR: case D3DERR_DRIVERINTERNALERROR:
case D3DERR_DEVICELOST: case D3DERR_DEVICELOST:
case D3DERR_DEVICEHUNG:
return error(GL_OUT_OF_MEMORY); return error(GL_OUT_OF_MEMORY);
default: default:
UNREACHABLE(); UNREACHABLE();
......
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