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

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

Issue 9570023: Fails glLinkProgram if two glBindAttribLocation conflicts. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 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
===================================================================
--- gpu/command_buffer/service/program_manager.cc (revision 123809)
+++ gpu/command_buffer/service/program_manager.cc (working copy)
@@ -168,6 +168,10 @@
set_log_info("missing shaders");
return;
}
+ if (DetectAttribLocationBindingConflicts()) {
+ set_log_info("glBindAttribLocation() conflicts");
+ return;
+ }
glLinkProgram(service_id());
GLint success = 0;
@@ -442,6 +446,30 @@
return true;
}
+bool ProgramManager::ProgramInfo::DetectAttribLocationBindingConflicts() const {
+ std::map<GLint, int> location_binding_count;
greggman 2012/03/01 22:49:36 could this just be std::set<GLint>?
+ for (std::map<std::string, GLint>::const_iterator it =
+ bind_attrib_location_map_.begin();
+ it != bind_attrib_location_map_.end(); ++it) {
+ // Find out if an attribute is declared in this program's shaders.
+ bool active = false;
+ for (int ii = 0; ii < kMaxAttachedShaders; ++ii) {
+ if (!attached_shaders_[ii] || !attached_shaders_[ii]->IsValid())
+ continue;
+ if (attached_shaders_[ii]->GetAttribInfo(it->first)) {
+ active = true;
+ break;
+ }
+ }
+ if (active) {
greggman 2012/03/01 22:49:36 If location_binding_count is a set then this would
+ if (location_binding_count.count(it->second) > 0)
+ return true;
+ location_binding_count[it->second] = 1;
+ }
+ }
+ return false;
+}
+
static uint32 ComputeOffset(const void* start, const void* position) {
return static_cast<const uint8*>(position) -
static_cast<const uint8*>(start);
« 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