diff options
author | kbr <kbr@chromium.org> | 2015-05-22 18:03:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-23 01:03:55 +0000 |
commit | 7d1102c12bdde6f5d011e04a726a457b81e59cc2 (patch) | |
tree | 813b908276c2eee6ad2a2ccddd0e31f431e3800c | |
parent | 57e58c27f652657d93c6e3bc35822b9146e7f00a (diff) | |
download | chromium_src-7d1102c12bdde6f5d011e04a726a457b81e59cc2.zip chromium_src-7d1102c12bdde6f5d011e04a726a457b81e59cc2.tar.gz chromium_src-7d1102c12bdde6f5d011e04a726a457b81e59cc2.tar.bz2 |
Replace DCHECK in gl_helper_scaling.cc with logging.
The GLHelper interface doesn't have good ways to report errors to
callers (most methods return void), and the GLES2Interface it uses
doesn't have good support for detecting context loss.
It can't DCHECK about the results of OpenGL queries in the case that
the context is lost, so log if this happens. Examination of a few
users of GLHelper indicate that they already handle context loss
reasonably.
BUG=479975
Review URL: https://codereview.chromium.org/1152293003
Cr-Commit-Position: refs/heads/master@{#331213}
-rw-r--r-- | content/common/gpu/client/gl_helper_scaling.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/content/common/gpu/client/gl_helper_scaling.cc b/content/common/gpu/client/gl_helper_scaling.cc index ae7b0cf..b248d9d 100644 --- a/content/common/gpu/client/gl_helper_scaling.cc +++ b/content/common/gpu/client/gl_helper_scaling.cc @@ -191,7 +191,6 @@ class ScalerImpl : public GLHelper::ScalerInterface, ScopedBufferBinder<GL_ARRAY_BUFFER> buffer_binder( gl_, scaler_helper_->vertex_attributes_buffer_); - DCHECK(shader_program_->Initialized()); shader_program_->UseProgram(spec_.src_size, spec_.src_subrect, spec_.dst_size, @@ -868,6 +867,17 @@ void ShaderProgram::Setup(const GLchar* vertex_shader_text, scaling_vector_location_ = gl_->GetUniformLocation(program_, "scaling_vector"); color_weights_location_ = gl_->GetUniformLocation(program_, "color_weights"); + // The only reason fetching these attribute locations should fail is + // if the context was spontaneously lost (i.e., because the GPU + // process crashed, perhaps deliberately for testing). + // Unfortunately, the only way to reliably detect context loss from + // GLES2Interface would be to repeatedly call GetError(), and this + // seems fragile. Most of the APIs in GLHelper should be updated to + // be able to return an error. Fortunately, many users of this code + // check for context loss at a higher level. + if (!Initialized()) { + LOG(ERROR) << "ShaderProgram::Setup: initialization failed (context lost?)"; + } return; } |