| Index: gpu/command_buffer/service/error_state.cc
|
| diff --git a/gpu/command_buffer/service/error_state.cc b/gpu/command_buffer/service/error_state.cc
|
| index 42131aae886a55f71355f6a1e55dd8ca0d61f950..ca4af85036ba2e108d7aef2505c5401674907741 100644
|
| --- a/gpu/command_buffer/service/error_state.cc
|
| +++ b/gpu/command_buffer/service/error_state.cc
|
| @@ -57,6 +57,8 @@ class ErrorStateImpl : public ErrorState {
|
| const char* function_name) override;
|
|
|
| private:
|
| + GLenum GetErrorHandleContextLoss();
|
| +
|
| // The last error message set.
|
| std::string last_error_;
|
| // Current GL error bits.
|
| @@ -83,7 +85,7 @@ ErrorStateImpl::~ErrorStateImpl() {}
|
|
|
| uint32 ErrorStateImpl::GetGLError() {
|
| // Check the GL error first, then our wrapped error.
|
| - GLenum error = glGetError();
|
| + GLenum error = GetErrorHandleContextLoss();
|
| if (error == GL_NO_ERROR && error_bits_ != 0) {
|
| for (uint32 mask = 1; mask != 0; mask = mask << 1) {
|
| if ((error_bits_ & mask) != 0) {
|
| @@ -100,9 +102,21 @@ uint32 ErrorStateImpl::GetGLError() {
|
| return error;
|
| }
|
|
|
| +GLenum ErrorStateImpl::GetErrorHandleContextLoss() {
|
| + GLenum error = glGetError();
|
| + if (error == GL_CONTEXT_LOST_KHR) {
|
| + client_->OnContextLostError();
|
| + // Do not expose GL_CONTEXT_LOST_KHR, as the version of the robustness
|
| + // extension that introduces the error is not exposed by the command
|
| + // buffer.
|
| + error = GL_NO_ERROR;
|
| + }
|
| + return error;
|
| +}
|
| +
|
| unsigned int ErrorStateImpl::PeekGLError(
|
| const char* filename, int line, const char* function_name) {
|
| - GLenum error = glGetError();
|
| + GLenum error = GetErrorHandleContextLoss();
|
| if (error != GL_NO_ERROR) {
|
| SetGLError(filename, line, error, function_name, "");
|
| }
|
| @@ -176,7 +190,7 @@ void ErrorStateImpl::SetGLErrorInvalidParamf(
|
| void ErrorStateImpl::CopyRealGLErrorsToWrapper(
|
| const char* filename, int line, const char* function_name) {
|
| GLenum error;
|
| - while ((error = glGetError()) != GL_NO_ERROR) {
|
| + while ((error = GetErrorHandleContextLoss()) != GL_NO_ERROR) {
|
| SetGLError(filename, line, error, function_name,
|
| "<- error from previous GL command");
|
| }
|
| @@ -187,7 +201,7 @@ void ErrorStateImpl::ClearRealGLErrors(
|
| // Clears and logs all current gl errors.
|
| GLenum error;
|
| while ((error = glGetError()) != GL_NO_ERROR) {
|
| - if (error != GL_OUT_OF_MEMORY) {
|
| + if (error != GL_CONTEXT_LOST_KHR && error != GL_OUT_OF_MEMORY) {
|
| // GL_OUT_OF_MEMORY can legally happen on lost device.
|
| logger_->LogMessage(
|
| filename, line,
|
|
|