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

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

Issue 1309743005: command_buffer: Implement EXT_blend_func_extended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-05-path-fragment-input-gen
Patch Set: rebase Created 5 years 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
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 939473afefdc88686eb5a05be066b3d9514f6859..d047b571961dd703fb806d06815cd4580c3b61d9 100644
--- a/gpu/command_buffer/client/program_info_manager.cc
+++ b/gpu/command_buffer/client/program_info_manager.cc
@@ -160,6 +160,19 @@ GLuint ProgramInfoManager::Program::GetUniformIndex(
return GL_INVALID_INDEX;
}
+GLint ProgramInfoManager::Program::GetFragDataIndex(
+ const std::string& name) const {
+ auto iter = frag_data_indices_.find(name);
+ if (iter == frag_data_indices_.end())
+ return -1;
+ return iter->second;
+}
+
+void ProgramInfoManager::Program::CacheFragDataIndex(const std::string& name,
+ GLint index) {
+ frag_data_indices_[name] = index;
+}
+
GLint ProgramInfoManager::Program::GetFragDataLocation(
const std::string& name) const {
base::hash_map<std::string, GLint>::const_iterator iter =
@@ -725,6 +738,31 @@ GLint ProgramInfoManager::GetUniformLocation(
return gl->GetUniformLocationHelper(program, name);
}
+GLint ProgramInfoManager::GetFragDataIndex(GLES2Implementation* gl,
+ GLuint program,
+ const char* name) {
+ // TODO(zmo): make FragData indexes part of the ProgramInfo that are
+ // fetched from the service side. See crbug.com/452104.
+ {
+ base::AutoLock auto_lock(lock_);
+ Program* info = GetProgramInfo(gl, program, kNone);
+ if (info) {
+ GLint possible_index = info->GetFragDataIndex(name);
+ if (possible_index != -1)
+ return possible_index;
+ }
+ }
+ GLint index = gl->GetFragDataIndexEXTHelper(program, name);
+ if (index != -1) {
+ base::AutoLock auto_lock(lock_);
+ Program* info = GetProgramInfo(gl, program, kNone);
+ if (info) {
+ info->CacheFragDataIndex(name, index);
+ }
+ }
+ return index;
+}
+
GLint ProgramInfoManager::GetFragDataLocation(
GLES2Implementation* gl, GLuint program, const char* name) {
// TODO(zmo): make FragData locations part of the ProgramInfo that are
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698