Chromium Code Reviews| 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 fa72a021534d23d6d2175f0c84ba7de32892d0fc..12557419b398545f87e541a029dd4b3a97dcece6 100644 |
| --- a/gpu/command_buffer/service/program_manager.cc |
| +++ b/gpu/command_buffer/service/program_manager.cc |
| @@ -1073,6 +1073,14 @@ bool Program::Link(ShaderManager* manager, |
| set_log_info("glBindUniformLocationCHROMIUM() conflicts"); |
| return false; |
| } |
| + if (DetectInterfaceBlocksMismatch(&conflicting_name)) { |
| + std::string info_log = |
| + "Interface blocks with the same name but different" |
| + " fields/layout: " + |
| + conflicting_name; |
| + set_log_info(ProcessLogInfo(info_log).c_str()); |
| + return false; |
| + } |
| if (DetectVaryingsMismatch(&conflicting_name)) { |
| std::string info_log = "Varyings with the same name but different type, " |
| "or statically used varyings in fragment shader " |
| @@ -1620,6 +1628,29 @@ bool Program::DetectUniformsMismatch(std::string* conflicting_name) const { |
| return false; |
| } |
| +bool Program::DetectInterfaceBlocksMismatch( |
| + std::string* conflicting_name) const { |
| + std::map<std::string, const sh::InterfaceBlock*> interface_pointer_map; |
| + for (auto shader : attached_shaders_) { |
| + const InterfaceBlockMap& shader_interfaces = shader->interface_block_map(); |
| + for (const auto& it : shader_interfaces) { |
| + const auto& name = it.first; |
| + auto hit = interface_pointer_map.find(name); |
| + if (hit == interface_pointer_map.end()) { |
| + interface_pointer_map[name] = &(it.second); |
| + } else { |
| + // If an interface is in the map, i.e., it has already been declared by |
| + // another shader, then the layout must match. |
| + if (hit->second->isSameInterfaceBlockAtLinkTime(it.second)) |
|
Ken Russell (switch to Gerrit)
2016/07/12 20:37:13
Is isSameInterfaceBlockAtLinkTime a new method in
|
| + continue; |
| + *conflicting_name = name; |
| + return true; |
| + } |
| + } |
| + } |
| + return false; |
| +} |
| + |
| bool Program::DetectVaryingsMismatch(std::string* conflicting_name) const { |
| DCHECK(attached_shaders_[0].get() && |
| attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && |