Commit 6db8cab4 by apatrick@chromium.org

ReadPixels recovers from device lost error.

I found that when I switch desktops, GetRenderTargetData will return D3DERR_DEVICELOST. It is unclear to me whether ReadPixels should report a GL error in this case and if so, which one. I went with GL_OUT_OF_MEMORY. Let me know if that's wrong. This change is not sufficient to make eglGetError report EGL_CONTEXT_LOST. For a program doing exclusively offscreen rendering, ReadPixels might be the only place where D3DERR_DEVICELOST can be detected. The GLES code can't call egl::setCurrentError though. I'm not sure how to fix that. Review URL: http://codereview.appspot.com/1692053 git-svn-id: https://angleproject.googlecode.com/svn/trunk@350 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c54bf507
......@@ -2116,19 +2116,19 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
result = device->GetRenderTargetData(renderTarget, systemSurface);
if (result == D3DERR_DRIVERINTERNALERROR)
{
systemSurface->Release();
return error(GL_OUT_OF_MEMORY);
}
if (FAILED(result))
{
UNREACHABLE();
systemSurface->Release();
return; // No sensible error to generate
switch (result)
{
case D3DERR_DRIVERINTERNALERROR:
case D3DERR_DEVICELOST:
return error(GL_OUT_OF_MEMORY);
default:
UNREACHABLE();
return; // No sensible error to generate
}
}
D3DLOCKED_RECT lock;
......
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