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

Side by Side Diff: gpu/command_buffer/service/program_manager.cc

Issue 159173003: Revert 250147 "Merge 249547 "Add a gpu driver bug workaround to ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/program_manager.h" 5 #include "gpu/command_buffer/service/program_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 << "unless the driver is buggy:" 515 << "unless the driver is buggy:"
516 << "\n--original-shader--\n" << (source ? *source : std::string()) 516 << "\n--original-shader--\n" << (source ? *source : std::string())
517 << "\n--translated-shader--\n" << shader_src << "\n--info-log--\n" 517 << "\n--translated-shader--\n" << shader_src << "\n--info-log--\n"
518 << *shader->log_info(); 518 << *shader->log_info();
519 } 519 }
520 } 520 }
521 521
522 bool Program::Link(ShaderManager* manager, 522 bool Program::Link(ShaderManager* manager,
523 ShaderTranslator* vertex_translator, 523 ShaderTranslator* vertex_translator,
524 ShaderTranslator* fragment_translator, 524 ShaderTranslator* fragment_translator,
525 Program::VaryingsPackingOption varyings_packing_option,
526 const ShaderCacheCallback& shader_callback) { 525 const ShaderCacheCallback& shader_callback) {
527 ClearLinkStatus(); 526 ClearLinkStatus();
528 if (!CanLink()) { 527 if (!CanLink()) {
529 set_log_info("missing shaders"); 528 set_log_info("missing shaders");
530 return false; 529 return false;
531 } 530 }
532 if (DetectAttribLocationBindingConflicts()) { 531 if (DetectAttribLocationBindingConflicts()) {
533 set_log_info("glBindAttribLocation() conflicts"); 532 set_log_info("glBindAttribLocation() conflicts");
534 return false; 533 return false;
535 } 534 }
536 if (DetectUniformsMismatch()) { 535 if (DetectUniformsMismatch()) {
537 set_log_info("Uniforms with the same name but different type/precision"); 536 set_log_info("Uniforms with the same name but different type/precision");
538 return false; 537 return false;
539 } 538 }
540 if (DetectVaryingsMismatch()) { 539 if (DetectVaryingsMismatch()) {
541 set_log_info("Varyings with the same name but different type, " 540 set_log_info("Varyings with the same name but different type, "
542 "or statically used varyings in fragment shader are not " 541 "or statically used varyings in fragment shader are not "
543 "declared in vertex shader"); 542 "declared in vertex shader");
544 return false; 543 return false;
545 } 544 }
546 if (DetectGlobalNameConflicts()) { 545 if (DetectGlobalNameConflicts()) {
547 set_log_info("Name conflicts between an uniform and an attribute"); 546 set_log_info("Name conflicts between an uniform and an attribute");
548 return false; 547 return false;
549 } 548 }
550 if (!CheckVaryingsPacking(varyings_packing_option)) { 549 if (!CheckVaryingsPacking()) {
551 set_log_info("Varyings over maximum register limit"); 550 set_log_info("Varyings over maximum register limit");
552 return false; 551 return false;
553 } 552 }
554 553
555 TimeTicks before_time = TimeTicks::HighResNow(); 554 TimeTicks before_time = TimeTicks::HighResNow();
556 bool link = true; 555 bool link = true;
557 ProgramCache* cache = manager_->program_cache_; 556 ProgramCache* cache = manager_->program_cache_;
558 if (cache) { 557 if (cache) {
559 DCHECK(attached_shaders_[0]->signature_source() && 558 DCHECK(attached_shaders_[0]->signature_source() &&
560 attached_shaders_[1]->signature_source()); 559 attached_shaders_[1]->signature_source());
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 for (ShaderTranslator::VariableMap::const_iterator iter = 1077 for (ShaderTranslator::VariableMap::const_iterator iter =
1079 attribs->begin(); iter != attribs->end(); ++iter) { 1078 attribs->begin(); iter != attribs->end(); ++iter) {
1080 for (int ii = 0; ii < 2; ++ii) { 1079 for (int ii = 0; ii < 2; ++ii) {
1081 if (uniforms[ii]->find(iter->first) != uniforms[ii]->end()) 1080 if (uniforms[ii]->find(iter->first) != uniforms[ii]->end())
1082 return true; 1081 return true;
1083 } 1082 }
1084 } 1083 }
1085 return false; 1084 return false;
1086 } 1085 }
1087 1086
1088 bool Program::CheckVaryingsPacking( 1087 bool Program::CheckVaryingsPacking() const {
1089 Program::VaryingsPackingOption option) const {
1090 DCHECK(attached_shaders_[0] && 1088 DCHECK(attached_shaders_[0] &&
1091 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && 1089 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER &&
1092 attached_shaders_[1] && 1090 attached_shaders_[1] &&
1093 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); 1091 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER);
1094 const ShaderTranslator::VariableMap* vertex_varyings = 1092 const ShaderTranslator::VariableMap* vertex_varyings =
1095 &(attached_shaders_[0]->varying_map()); 1093 &(attached_shaders_[0]->varying_map());
1096 const ShaderTranslator::VariableMap* fragment_varyings = 1094 const ShaderTranslator::VariableMap* fragment_varyings =
1097 &(attached_shaders_[1]->varying_map()); 1095 &(attached_shaders_[1]->varying_map());
1098 1096
1099 std::map<std::string, ShVariableInfo> combined_map; 1097 std::map<std::string, ShVariableInfo> combined_map;
1100 1098
1101 for (ShaderTranslator::VariableMap::const_iterator iter = 1099 for (ShaderTranslator::VariableMap::const_iterator iter =
1102 fragment_varyings->begin(); 1100 fragment_varyings->begin();
1103 iter != fragment_varyings->end(); ++iter) { 1101 iter != fragment_varyings->end(); ++iter) {
1104 if (!iter->second.static_use && option == kCountOnlyStaticallyUsed) 1102 if (!iter->second.static_use)
1105 continue; 1103 continue;
1106 if (!IsBuiltInVarying(iter->first)) { 1104 if (!IsBuiltInVarying(iter->first)) {
1107 ShaderTranslator::VariableMap::const_iterator vertex_iter = 1105 ShaderTranslator::VariableMap::const_iterator vertex_iter =
1108 vertex_varyings->find(iter->first); 1106 vertex_varyings->find(iter->first);
1109 if (vertex_iter == vertex_varyings->end() || 1107 if (vertex_iter == vertex_varyings->end() ||
1110 (!vertex_iter->second.static_use && 1108 !vertex_iter->second.static_use)
1111 option == kCountOnlyStaticallyUsed))
1112 continue; 1109 continue;
1113 } 1110 }
1114 1111
1115 ShVariableInfo var; 1112 ShVariableInfo var;
1116 var.type = static_cast<ShDataType>(iter->second.type); 1113 var.type = static_cast<ShDataType>(iter->second.type);
1117 var.size = iter->second.size; 1114 var.size = iter->second.size;
1118 combined_map[iter->first] = var; 1115 combined_map[iter->first] = var;
1119 } 1116 }
1120 1117
1121 if (combined_map.size() == 0) 1118 if (combined_map.size() == 0)
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 DCHECK(program); 1347 DCHECK(program);
1351 program->ClearUniforms(&zero_); 1348 program->ClearUniforms(&zero_);
1352 } 1349 }
1353 1350
1354 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { 1351 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) {
1355 return index + element * 0x10000; 1352 return index + element * 0x10000;
1356 } 1353 }
1357 1354
1358 } // namespace gles2 1355 } // namespace gles2
1359 } // namespace gpu 1356 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | gpu/command_buffer/service/program_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698