OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/error_state.h" | 5 #include "gpu/command_buffer/service/error_state.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void ErrorStateImpl::SetGLError( | 106 void ErrorStateImpl::SetGLError( |
107 const char* filename, | 107 const char* filename, |
108 int line, | 108 int line, |
109 unsigned int error, | 109 unsigned int error, |
110 const char* function_name, | 110 const char* function_name, |
111 const char* msg) { | 111 const char* msg) { |
112 if (msg) { | 112 if (msg) { |
113 last_error_ = msg; | 113 last_error_ = msg; |
114 logger_->LogMessage( | 114 logger_->LogMessage( |
115 filename, line, | 115 filename, line, |
116 logger_->GetLogPrefix() + ": " + std::string("GL ERROR :") + | 116 std::string("GL ERROR :") + |
117 GLES2Util::GetStringEnum(error) + " : " + | 117 GLES2Util::GetStringEnum(error) + " : " + |
118 function_name + ": " + msg); | 118 function_name + ": " + msg); |
119 } | 119 } |
120 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); | 120 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |
121 } | 121 } |
122 | 122 |
123 void ErrorStateImpl::SetGLErrorInvalidEnum( | 123 void ErrorStateImpl::SetGLErrorInvalidEnum( |
124 const char* filename, | 124 const char* filename, |
125 int line, | 125 int line, |
126 const char* function_name, | 126 const char* function_name, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void ErrorStateImpl::ClearRealGLErrors( | 164 void ErrorStateImpl::ClearRealGLErrors( |
165 const char* filename, int line, const char* function_name) { | 165 const char* filename, int line, const char* function_name) { |
166 // Clears and logs all current gl errors. | 166 // Clears and logs all current gl errors. |
167 GLenum error; | 167 GLenum error; |
168 while ((error = glGetError()) != GL_NO_ERROR) { | 168 while ((error = glGetError()) != GL_NO_ERROR) { |
169 if (error != GL_OUT_OF_MEMORY) { | 169 if (error != GL_OUT_OF_MEMORY) { |
170 // GL_OUT_OF_MEMORY can legally happen on lost device. | 170 // GL_OUT_OF_MEMORY can legally happen on lost device. |
171 logger_->LogMessage( | 171 logger_->LogMessage( |
172 filename, line, | 172 filename, line, |
173 logger_->GetLogPrefix() + ": " + std::string("GL ERROR :") + | 173 std::string("GL ERROR :") + |
174 GLES2Util::GetStringEnum(error) + " : " + | 174 GLES2Util::GetStringEnum(error) + " : " + |
175 function_name + ": was unhandled"); | 175 function_name + ": was unhandled"); |
176 NOTREACHED() << "GL error " << error << " was unhandled."; | 176 NOTREACHED() << "GL error " << error << " was unhandled."; |
177 } | 177 } |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 } // namespace gles2 | 181 } // namespace gles2 |
182 } // namespace gpu | 182 } // namespace gpu |
183 | 183 |
OLD | NEW |