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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 continue; | 1093 continue; |
1094 *conflicting_name = name; | 1094 *conflicting_name = name; |
1095 return true; | 1095 return true; |
1096 } | 1096 } |
1097 } | 1097 } |
1098 } | 1098 } |
1099 return false; | 1099 return false; |
1100 } | 1100 } |
1101 | 1101 |
1102 bool Program::DetectVaryingsMismatch(std::string* conflicting_name) const { | 1102 bool Program::DetectVaryingsMismatch(std::string* conflicting_name) const { |
1103 DCHECK(attached_shaders_[0] && | 1103 DCHECK(attached_shaders_[0].get() && |
1104 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && | 1104 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && |
1105 attached_shaders_[1] && | 1105 attached_shaders_[1].get() && |
1106 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); | 1106 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); |
1107 const ShaderTranslator::VariableMap* vertex_varyings = | 1107 const ShaderTranslator::VariableMap* vertex_varyings = |
1108 &(attached_shaders_[0]->varying_map()); | 1108 &(attached_shaders_[0]->varying_map()); |
1109 const ShaderTranslator::VariableMap* fragment_varyings = | 1109 const ShaderTranslator::VariableMap* fragment_varyings = |
1110 &(attached_shaders_[1]->varying_map()); | 1110 &(attached_shaders_[1]->varying_map()); |
1111 | 1111 |
1112 for (ShaderTranslator::VariableMap::const_iterator iter = | 1112 for (ShaderTranslator::VariableMap::const_iterator iter = |
1113 fragment_varyings->begin(); | 1113 fragment_varyings->begin(); |
1114 iter != fragment_varyings->end(); ++iter) { | 1114 iter != fragment_varyings->end(); ++iter) { |
1115 const std::string& name = iter->first; | 1115 const std::string& name = iter->first; |
(...skipping 14 matching lines...) Expand all Loading... |
1130 hit->second.size != iter->second.size) { | 1130 hit->second.size != iter->second.size) { |
1131 *conflicting_name = name; | 1131 *conflicting_name = name; |
1132 return true; | 1132 return true; |
1133 } | 1133 } |
1134 | 1134 |
1135 } | 1135 } |
1136 return false; | 1136 return false; |
1137 } | 1137 } |
1138 | 1138 |
1139 bool Program::DetectGlobalNameConflicts(std::string* conflicting_name) const { | 1139 bool Program::DetectGlobalNameConflicts(std::string* conflicting_name) const { |
1140 DCHECK(attached_shaders_[0] && | 1140 DCHECK(attached_shaders_[0].get() && |
1141 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && | 1141 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && |
1142 attached_shaders_[1] && | 1142 attached_shaders_[1].get() && |
1143 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); | 1143 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); |
1144 const ShaderTranslator::VariableMap* uniforms[2]; | 1144 const ShaderTranslator::VariableMap* uniforms[2]; |
1145 uniforms[0] = &(attached_shaders_[0]->uniform_map()); | 1145 uniforms[0] = &(attached_shaders_[0]->uniform_map()); |
1146 uniforms[1] = &(attached_shaders_[1]->uniform_map()); | 1146 uniforms[1] = &(attached_shaders_[1]->uniform_map()); |
1147 const ShaderTranslator::VariableMap* attribs = | 1147 const ShaderTranslator::VariableMap* attribs = |
1148 &(attached_shaders_[0]->attrib_map()); | 1148 &(attached_shaders_[0]->attrib_map()); |
1149 | 1149 |
1150 for (ShaderTranslator::VariableMap::const_iterator iter = | 1150 for (ShaderTranslator::VariableMap::const_iterator iter = |
1151 attribs->begin(); iter != attribs->end(); ++iter) { | 1151 attribs->begin(); iter != attribs->end(); ++iter) { |
1152 for (int ii = 0; ii < 2; ++ii) { | 1152 for (int ii = 0; ii < 2; ++ii) { |
1153 if (uniforms[ii]->find(iter->first) != uniforms[ii]->end()) { | 1153 if (uniforms[ii]->find(iter->first) != uniforms[ii]->end()) { |
1154 *conflicting_name = iter->first; | 1154 *conflicting_name = iter->first; |
1155 return true; | 1155 return true; |
1156 } | 1156 } |
1157 } | 1157 } |
1158 } | 1158 } |
1159 return false; | 1159 return false; |
1160 } | 1160 } |
1161 | 1161 |
1162 bool Program::CheckVaryingsPacking( | 1162 bool Program::CheckVaryingsPacking( |
1163 Program::VaryingsPackingOption option) const { | 1163 Program::VaryingsPackingOption option) const { |
1164 DCHECK(attached_shaders_[0] && | 1164 DCHECK(attached_shaders_[0].get() && |
1165 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && | 1165 attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && |
1166 attached_shaders_[1] && | 1166 attached_shaders_[1].get() && |
1167 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); | 1167 attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); |
1168 const ShaderTranslator::VariableMap* vertex_varyings = | 1168 const ShaderTranslator::VariableMap* vertex_varyings = |
1169 &(attached_shaders_[0]->varying_map()); | 1169 &(attached_shaders_[0]->varying_map()); |
1170 const ShaderTranslator::VariableMap* fragment_varyings = | 1170 const ShaderTranslator::VariableMap* fragment_varyings = |
1171 &(attached_shaders_[1]->varying_map()); | 1171 &(attached_shaders_[1]->varying_map()); |
1172 | 1172 |
1173 std::map<std::string, ShVariableInfo> combined_map; | 1173 std::map<std::string, ShVariableInfo> combined_map; |
1174 | 1174 |
1175 for (ShaderTranslator::VariableMap::const_iterator iter = | 1175 for (ShaderTranslator::VariableMap::const_iterator iter = |
1176 fragment_varyings->begin(); | 1176 fragment_varyings->begin(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 DCHECK(program); | 1428 DCHECK(program); |
1429 program->ClearUniforms(&zero_); | 1429 program->ClearUniforms(&zero_); |
1430 } | 1430 } |
1431 | 1431 |
1432 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1432 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
1433 return index + element * 0x10000; | 1433 return index + element * 0x10000; |
1434 } | 1434 } |
1435 | 1435 |
1436 } // namespace gles2 | 1436 } // namespace gles2 |
1437 } // namespace gpu | 1437 } // namespace gpu |
OLD | NEW |