Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: gpu/command_buffer/client/program_info_manager.cc

Issue 906613005: Add glUniformBlockBinding to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uniform
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.h ('k') | gpu/command_buffer/client/program_info_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698