Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: gpu/command_buffer/service/error_state.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/error_state.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « gpu/command_buffer/service/error_state.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698