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

Unified Diff: gpu/command_buffer/service/program_manager.cc

Issue 2852923004: Remove NameMap from shader translator and shader/program managers (Closed)
Patch Set: split CL Created 3 years, 8 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/service/program_manager.cc
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
index f8dcbc197a9a5113feda4e464e7572495238e9bb..961335df8e344828d7bd71df3d924f844b5f215d 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -1555,6 +1555,31 @@ const std::string* Program::GetOriginalNameFromHashedName(
return nullptr;
}
+const sh::Varying* Program::GetVaryingInfo(
+ const std::string& hashed_name) const {
+ for (auto shader : attached_shaders_) {
+ if (shader) {
+ const sh::Varying* info = shader->GetVaryingInfo(hashed_name);
+ if (info)
+ return info;
+ }
+ }
+ return nullptr;
+}
+
+const sh::InterfaceBlock* Program::GetInterfaceBlockInfo(
+ const std::string& hashed_name) const {
+ for (auto shader : attached_shaders_) {
+ if (shader) {
+ const sh::InterfaceBlock* info =
+ shader->GetInterfaceBlockInfo(hashed_name);
+ if (info)
+ return info;
+ }
+ }
+ return nullptr;
+}
+
const Program::FragmentInputInfo* Program::GetFragmentInputInfoByFakeLocation(
GLint fake_location) const {
if (fake_location < 0)
@@ -2231,16 +2256,16 @@ bool Program::GetUniformBlocks(CommonDecoder::Bucket* bucket) const {
names[ii] = std::string(&buffer[0], length);
// TODO(zmo): optimize the name mapping lookup.
size_t pos = names[ii].find_first_of('[');
- const std::string* original_name;
+ const sh::InterfaceBlock* interface_block = nullptr;
std::string array_index_str = "";
if (pos != std::string::npos) {
- original_name = GetOriginalNameFromHashedName(names[ii].substr(0, pos));
+ interface_block = GetInterfaceBlockInfo(names[ii].substr(0, pos));
array_index_str = names[ii].substr(pos);
} else {
- original_name = GetOriginalNameFromHashedName(names[ii]);
+ interface_block = GetInterfaceBlockInfo(names[ii]);
}
- if (original_name)
- names[ii] = *original_name + array_index_str;
+ if (interface_block)
+ names[ii] = interface_block->name + array_index_str;
Ken Russell (switch to Gerrit) 2017/05/03 22:52:48 This change is well tested with the existing confo
Kai Ninomiya 2017/05/03 23:02:34 That the interface block name returned will be the
blocks[ii].name_length = names[ii].size() + 1;
size += blocks[ii].name_length;
@@ -2371,9 +2396,9 @@ bool Program::GetTransformFeedbackVaryings(
DCHECK_GT(max_name_length, var_name_length);
names[ii] = std::string(&buffer[0], var_name_length);
// TODO(zmo): optimize the name mapping lookup.
Zhenyao Mo 2017/05/03 23:24:12 You can probably remove this comment because I don
- const std::string* original_name = GetOriginalNameFromHashedName(names[ii]);
- if (original_name)
- names[ii] = *original_name;
+ const sh::Varying* varying = GetVaryingInfo(names[ii]);
+ if (varying)
+ names[ii] = varying->name;
Ken Russell (switch to Gerrit) 2017/05/03 22:52:48 Same question here.
Kai Ninomiya 2017/05/03 23:02:34 Ditto.
varyings[ii].name_length = names[ii].size() + 1;
size += names[ii].size();
size += 1;

Powered by Google App Engine
This is Rietveld 408576698