summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-04 04:02:48 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-04 04:02:48 +0000
commitfa20ec8ad1a9df35a00846f24741a5f7e8669a87 (patch)
tree58cfbcfad60fb818e0c9b22b5e6840e8d8c5767f /gpu/command_buffer
parent5c8b5d5385acf4e2fa677ec7150edcc0248bdf9f (diff)
downloadchromium_src-fa20ec8ad1a9df35a00846f24741a5f7e8669a87.zip
chromium_src-fa20ec8ad1a9df35a00846f24741a5f7e8669a87.tar.gz
chromium_src-fa20ec8ad1a9df35a00846f24741a5f7e8669a87.tar.bz2
Limit the number of GL errors logged
Because too many uses memory and too many IPCs TEST=ran by hand, tested with and without --disable-gl-error-limti BUG=none Review URL: http://codereview.chromium.org/10375005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc31
-rw-r--r--gpu/command_buffer/service/gpu_switches.cc4
-rw-r--r--gpu/command_buffer/service/gpu_switches.h1
3 files changed, 29 insertions, 7 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 9568ce1..ebb56bc 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -460,6 +460,8 @@ bool GLES2Decoder::IsAngle() {
class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
public GLES2Decoder {
public:
+ static const int kMaxLogErrors = 256;
+
explicit GLES2DecoderImpl(ContextGroup* group);
~GLES2DecoderImpl();
@@ -1474,6 +1476,8 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
// The last error message set.
std::string last_error_;
+ int error_count_;
+
// The current decoder error.
error::Error current_decoder_error_;
@@ -1905,6 +1909,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
back_buffer_has_stencil_(false),
teximage2d_faster_than_texsubimage2d_(true),
bufferdata_faster_than_buffersubdata_(true),
+ error_count_(0),
current_decoder_error_(error::kNoError),
use_shader_translator_(true),
validators_(group_->feature_info()->validators()),
@@ -4845,13 +4850,25 @@ GLenum GLES2DecoderImpl::PeekGLError() {
void GLES2DecoderImpl::SetGLError(GLenum error, const char* msg) {
if (msg) {
last_error_ = msg;
- // LOG this unless logging is turned off as any chromium code that generates
- // these errors probably has a bug.
- if (log_synthesized_gl_errors()) {
- LOG(ERROR) << last_error_;
- }
- if (!msg_callback_.is_null()) {
- msg_callback_.Run(0, GLES2Util::GetStringEnum(error) + " : " + msg);
+ if (error_count_ < kMaxLogErrors ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGLErrorLimit)) {
+ ++error_count_;
+ // LOG this unless logging is turned off as any chromium code that
+ // generates these errors probably has a bug.
+ if (log_synthesized_gl_errors()) {
+ LOG(ERROR) << last_error_;
+ }
+ if (!msg_callback_.is_null()) {
+ msg_callback_.Run(0, GLES2Util::GetStringEnum(error) + " : " + msg);
+ }
+ } else {
+ if (error_count_ == kMaxLogErrors) {
+ ++error_count_;
+ LOG(ERROR)
+ << "Too many GL errors, not reporting any more for this context."
+ << " use --disable-gl-error-limit to see all errors.";
+ }
}
}
error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
diff --git a/gpu/command_buffer/service/gpu_switches.cc b/gpu/command_buffer/service/gpu_switches.cc
index ed5e083..8174e53 100644
--- a/gpu/command_buffer/service/gpu_switches.cc
+++ b/gpu/command_buffer/service/gpu_switches.cc
@@ -10,6 +10,9 @@ namespace switches {
// Turn on Calling GL Error after every command.
const char kCompileShaderAlwaysSucceeds[] = "compile-shader-always-succeeds";
+// Disable the GL error log limit.
+const char kDisableGLErrorLimit[] = "disable-gl-error-limit";
+
// Disable the GLSL translator.
const char kDisableGLSLTranslator[] = "disable-glsl-translator";
@@ -24,6 +27,7 @@ const char kEnforceGLMinimums[] = "enforce-gl-minimums";
const char* kGpuSwitches[] = {
kCompileShaderAlwaysSucceeds,
+ kDisableGLErrorLimit,
kDisableGLSLTranslator,
kEnableGPUCommandLogging,
kEnableGPUDebugging,
diff --git a/gpu/command_buffer/service/gpu_switches.h b/gpu/command_buffer/service/gpu_switches.h
index 561058e..735bcdf 100644
--- a/gpu/command_buffer/service/gpu_switches.h
+++ b/gpu/command_buffer/service/gpu_switches.h
@@ -13,6 +13,7 @@
namespace switches {
GPU_EXPORT extern const char kCompileShaderAlwaysSucceeds[];
+GPU_EXPORT extern const char kDisableGLErrorLimit[];
GPU_EXPORT extern const char kDisableGLSLTranslator[];
GPU_EXPORT extern const char kEnableGPUCommandLogging[];
GPU_EXPORT extern const char kEnableGPUDebugging[];