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

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

Issue 2147663002: program_manager: detect interface block mismatches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/program_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 &&
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698