Merge pull request #9134 from samcake/blue

Fix a bug when using the gpu::Batch::_glUniform*() calls  with a bad location
This commit is contained in:
Brad Hefta-Gaub 2016-12-01 09:03:56 -08:00 committed by GitHub
commit e0bcbb08ff

View file

@ -40,10 +40,14 @@ public:
return _shaderObjects[version].glprogram;
}
GLint getUniformLocation(GLint srcLoc, Version version = Mono) {
// THIS will be used in the future PR as we grow the number of versions
return _uniformMappings[version][srcLoc];
// return srcLoc;
GLint getUniformLocation(GLint srcLoc, Version version = Mono) const {
// This check protect against potential invalid src location for this shader, if unknown then return -1.
const auto& mapping = _uniformMappings[version];
auto found = mapping.find(srcLoc);
if (found == mapping.end()) {
return -1;
}
return found->second;
}
const std::weak_ptr<GLBackend> _backend;