diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 00:17:34 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 00:17:34 +0000 |
commit | 05afda1f2a7e8584d23878b5994b8cdfbc678c60 (patch) | |
tree | 31a85b88367458717cf3a87ca717d77329213767 /gpu | |
parent | 9277111a69aa069feec820d7a31cc33e3e988bdb (diff) | |
download | chromium_src-05afda1f2a7e8584d23878b5994b8cdfbc678c60.zip chromium_src-05afda1f2a7e8584d23878b5994b8cdfbc678c60.tar.gz chromium_src-05afda1f2a7e8584d23878b5994b8cdfbc678c60.tar.bz2 |
Fix for gl programs. An unsuccessful link should report
the link is unsuccessful but not replace the old program.
TEST=webgl conformance tests pass
BUG=none
Review URL: http://codereview.chromium.org/6242006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/program_manager.cc | 7 | ||||
-rw-r--r-- | gpu/command_buffer/service/program_manager.h | 15 |
3 files changed, 19 insertions, 8 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 4537212..9a5c544 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -3607,16 +3607,17 @@ void GLES2DecoderImpl::DoLinkProgram(GLuint program) { if (!info) { return; } + + info->ClearLinkStatus(); if (!info->CanLink()) { return; } + glLinkProgram(info->service_id()); GLint success = 0; glGetProgramiv(info->service_id(), GL_LINK_STATUS, &success); if (success) { info->Update(); - } else { - info->Reset(); } }; diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 339aff5..a88a678 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -48,11 +48,13 @@ ProgramManager::ProgramInfo::ProgramInfo(GLuint service_id) max_attrib_name_length_(0), max_uniform_name_length_(0), service_id_(service_id), - valid_(false) { + valid_(false), + link_status_(false) { } void ProgramManager::ProgramInfo::Reset() { valid_ = false; + link_status_ = false; max_uniform_name_length_ = 0; max_attrib_name_length_ = 0; attrib_infos_.clear(); @@ -76,6 +78,7 @@ void ProgramManager::ProgramInfo::UpdateLogInfo() { void ProgramManager::ProgramInfo::Update() { Reset(); + link_status_ = true; GLint num_attribs = 0; GLint max_len = 0; GLint max_location = -1; @@ -337,7 +340,7 @@ void ProgramManager::ProgramInfo::GetProgramiv(GLenum pname, GLint* params) { *params = max_uniform_name_length_ + 1; break; case GL_LINK_STATUS: - *params = valid_; + *params = link_status_; break; case GL_INFO_LOG_LENGTH: // Notice +1 to accomodate NULL terminator. diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h index b7229d9..ab51bf1 100644 --- a/gpu/command_buffer/service/program_manager.h +++ b/gpu/command_buffer/service/program_manager.h @@ -75,9 +75,6 @@ class ProgramManager { return sampler_indices_; } - // Resets the program after an unsuccessful link. - void Reset(); - // Updates the program info after a successful link. void Update(); @@ -131,6 +128,10 @@ class ProgramManager { return valid_; } + void ClearLinkStatus() { + link_status_ = false; + } + bool AttachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info); void DetachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info); @@ -169,6 +170,9 @@ class ProgramManager { service_id_ = 0; } + // Resets the program. + void Reset(); + const UniformInfo* AddUniformInfo( GLsizei size, GLenum type, GLint location, const std::string& name); @@ -205,9 +209,12 @@ class ProgramManager { // Shaders by type of shader. ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders]; - // This is true if glLinkProgram was successful. + // This is true if glLinkProgram was successful at least once. bool valid_; + // This is true if glLinkProgram was successful last time it was called. + bool link_status_; + // Log info std::string log_info_; }; |