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

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

Issue 2852923004: Remove NameMap from shader translator and shader/program managers (Closed)
Patch Set: remove some TODO(zmo)s 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
« no previous file with comments | « gpu/command_buffer/service/shader_manager.h ('k') | gpu/command_buffer/service/shader_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/shader_manager.cc
diff --git a/gpu/command_buffer/service/shader_manager.cc b/gpu/command_buffer/service/shader_manager.cc
index 38f371764a71905d1f306c6c9268c6e32927b877..8a77b519998ba6835bbf196fb134a8e6705384d0 100644
--- a/gpu/command_buffer/service/shader_manager.cc
+++ b/gpu/command_buffer/service/shader_manager.cc
@@ -75,7 +75,7 @@ void Shader::DoCompile() {
bool success = translator->Translate(
last_compiled_source_, &log_info_, &translated_source_,
&shader_version_, &attrib_map_, &uniform_map_, &varying_map_,
- &interface_block_map_, &output_variable_list_, &name_map_);
+ &interface_block_map_, &output_variable_list_);
if (!success) {
return;
}
@@ -224,19 +224,22 @@ const std::string* Shader::GetOutputVariableMappedName(
const std::string* Shader::GetOriginalNameFromHashedName(
const std::string& hashed_name) const {
- NameMap::const_iterator it = name_map_.find(hashed_name);
- if (it != name_map_.end())
- return &(it->second);
- return NULL;
-}
-
-const std::string* Shader::GetMappedName(
- const std::string& original_name) const {
- for (const auto& key_value : name_map_) {
- if (key_value.second == original_name)
- return &(key_value.first);
+ if (const auto* info = GetAttribInfo(hashed_name)) {
+ return &info->name;
}
- return NULL;
+ if (const auto* info = GetUniformInfo(hashed_name)) {
+ return &info->name;
+ }
+ if (const auto* info = GetVaryingInfo(hashed_name)) {
+ return &info->name;
+ }
+ if (const auto* info = GetInterfaceBlockInfo(hashed_name)) {
+ return &info->name;
+ }
+ if (const auto* info = GetOutputVariableInfo(hashed_name)) {
+ return &info->name;
+ }
+ return nullptr;
}
const sh::Uniform* Shader::GetUniformInfo(const std::string& name) const {
« no previous file with comments | « gpu/command_buffer/service/shader_manager.h ('k') | gpu/command_buffer/service/shader_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698