OLD | NEW |
---|---|
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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 if (DetectUniformsMismatch()) { | 551 if (DetectUniformsMismatch()) { |
552 set_log_info("Uniforms with the same name but different type/precision"); | 552 set_log_info("Uniforms with the same name but different type/precision"); |
553 return false; | 553 return false; |
554 } | 554 } |
555 if (DetectVaryingsMismatch()) { | 555 if (DetectVaryingsMismatch()) { |
556 set_log_info("Varyings with the same name but different type, " | 556 set_log_info("Varyings with the same name but different type, " |
557 "or statically used varyings in fragment shader are not " | 557 "or statically used varyings in fragment shader are not " |
558 "declared in vertex shader"); | 558 "declared in vertex shader"); |
559 return false; | 559 return false; |
560 } | 560 } |
561 if (DetectGlobalNameConflicts()) { | |
562 set_log_info("Name conflicts between a varying and an attribute"); | |
bajones
2013/09/07 00:00:14
varying -> uniform
| |
563 return false; | |
564 } | |
561 if (!CheckVaryingsPacking()) { | 565 if (!CheckVaryingsPacking()) { |
562 set_log_info("Varyings over maximum register limit"); | 566 set_log_info("Varyings over maximum register limit"); |
563 return false; | 567 return false; |
564 } | 568 } |
565 | 569 |
566 TimeTicks before_time = TimeTicks::HighResNow(); | 570 TimeTicks before_time = TimeTicks::HighResNow(); |
567 bool link = true; | 571 bool link = true; |
568 ProgramCache* cache = manager_->program_cache_; | 572 ProgramCache* cache = manager_->program_cache_; |
569 if (cache) { | 573 if (cache) { |
570 DCHECK(attached_shaders_[0]->signature_source() && | 574 DCHECK(attached_shaders_[0]->signature_source() && |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1065 } | 1069 } |
1066 | 1070 |
1067 if (hit->second.type != iter->second.type || | 1071 if (hit->second.type != iter->second.type || |
1068 hit->second.size != iter->second.size) | 1072 hit->second.size != iter->second.size) |
1069 return true; | 1073 return true; |
1070 | 1074 |
1071 } | 1075 } |
1072 return false; | 1076 return false; |
1073 } | 1077 } |
1074 | 1078 |
1079 bool Program::DetectGlobalNameConflicts() const { | |
1080 DCHECK(attached_shaders_[0] && | |
1081 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && | |
1082 attached_shaders_[1] && | |
1083 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); | |
1084 const ShaderTranslator::VariableMap* uniforms[2]; | |
1085 uniforms[0] = &(attached_shaders_[0]->uniform_map()); | |
1086 uniforms[1] = &(attached_shaders_[1]->uniform_map()); | |
1087 const ShaderTranslator::VariableMap* attribs = | |
1088 &(attached_shaders_[0]->attrib_map()); | |
1089 | |
1090 for (ShaderTranslator::VariableMap::const_iterator iter = | |
1091 attribs->begin(); iter != attribs->end(); ++iter) { | |
1092 for (int ii = 0; ii < 2; ++ii) { | |
1093 if (uniforms[ii]->find(iter->first) != uniforms[ii]->end()) | |
1094 return true; | |
1095 } | |
1096 } | |
1097 return false; | |
1098 } | |
1099 | |
1075 bool Program::CheckVaryingsPacking() const { | 1100 bool Program::CheckVaryingsPacking() const { |
1076 DCHECK(attached_shaders_[0] && | 1101 DCHECK(attached_shaders_[0] && |
1077 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && | 1102 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && |
1078 attached_shaders_[1] && | 1103 attached_shaders_[1] && |
1079 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); | 1104 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); |
1080 const ShaderTranslator::VariableMap* vertex_varyings = | 1105 const ShaderTranslator::VariableMap* vertex_varyings = |
1081 &(attached_shaders_[0]->varying_map()); | 1106 &(attached_shaders_[0]->varying_map()); |
1082 const ShaderTranslator::VariableMap* fragment_varyings = | 1107 const ShaderTranslator::VariableMap* fragment_varyings = |
1083 &(attached_shaders_[1]->varying_map()); | 1108 &(attached_shaders_[1]->varying_map()); |
1084 | 1109 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1338 program->ClearUniforms(&zero_); | 1363 program->ClearUniforms(&zero_); |
1339 } | 1364 } |
1340 } | 1365 } |
1341 | 1366 |
1342 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1367 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
1343 return index + element * 0x10000; | 1368 return index + element * 0x10000; |
1344 } | 1369 } |
1345 | 1370 |
1346 } // namespace gles2 | 1371 } // namespace gles2 |
1347 } // namespace gpu | 1372 } // namespace gpu |
OLD | NEW |