Chromium Code Reviews| Index: gpu/command_buffer/client/program_info_manager.cc |
| diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc |
| index b13f7c979b60227e97d71933ece5ff2cc4d36e2c..d1c6f9e1f7c3a86b109abbfc0aa0b55f0d69698b 100644 |
| --- a/gpu/command_buffer/client/program_info_manager.cc |
| +++ b/gpu/command_buffer/client/program_info_manager.cc |
| @@ -179,6 +179,13 @@ GLuint ProgramInfoManager::Program::GetUniformBlockIndex( |
| return GL_INVALID_INDEX; |
| } |
| +void ProgramInfoManager::Program::UniformBlockBinding( |
| + GLuint index , GLuint binding) { |
| + if (index < uniform_blocks_.size()) { |
| + uniform_blocks_[index].binding = binding; |
| + } |
| +} |
| + |
| void ProgramInfoManager::Program::UpdateES2(const std::vector<int8>& result) { |
| if (cached_es2_) { |
| return; |
| @@ -638,6 +645,20 @@ bool ProgramInfoManager::GetActiveUniformBlockiv( |
| return gl->GetActiveUniformBlockivHelper(program, index, pname, params); |
| } |
| +void ProgramInfoManager::UniformBlockBinding( |
| + GLES2Implementation* gl, GLuint program, GLuint index, GLuint binding) { |
| + GLuint max_bindings = |
| + static_cast<GLuint>(gl->capabilities().max_uniform_buffer_bindings); |
| + if (binding < max_bindings) { |
|
piman
2015/02/07 01:16:32
nit: do we care about this check? The check in Pro
Zhenyao Mo
2015/02/07 01:48:43
I think we do. The checking in Program::UniformBlo
piman
2015/02/07 01:50:58
Oh, you're right.
|
| + base::AutoLock auto_lock(lock_); |
| + // If UniformBlock info haven't been cached yet, skip updating the binding. |
| + Program* info = GetProgramInfo(gl, program, kNone); |
| + if (info) { |
| + info->UniformBlockBinding(index, binding); |
| + } |
| + } |
| +} |
| + |
| } // namespace gles2 |
| } // namespace gpu |