Bug 869703 - Fix failure to retrieve uniform. r=jgilbert

This commit is contained in:
Roberto Agostino Vitillo 2013-06-04 20:51:58 -04:00
parent dd8e29cc29
commit 9a36d271ff
2 changed files with 12 additions and 13 deletions

View File

@ -65,6 +65,18 @@ WebGLProgram::UpdateInfo()
}
}
if (!mUniformInfoMap) {
mUniformInfoMap = new CStringToUniformInfoMap;
mUniformInfoMap->Init();
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
const WebGLUniformInfo& info = mAttachedShaders[i]->mUniformInfos[j];
mUniformInfoMap->Put(uniform.mapped, info);
}
}
}
return true;
}

View File

@ -224,19 +224,6 @@ WebGLProgram::ReverseMapIdentifier(const nsACString& name, nsCString *reverseMap
WebGLUniformInfo
WebGLProgram::GetUniformInfoForMappedIdentifier(const nsACString& name) {
if (!mUniformInfoMap) {
// if the identifier-to-array-size map doesn't exist yet, build it now
mUniformInfoMap = new CStringToUniformInfoMap;
mUniformInfoMap->Init();
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
const WebGLUniformInfo& info = mAttachedShaders[i]->mUniformInfos[j];
mUniformInfoMap->Put(uniform.mapped, info);
}
}
}
nsCString mutableName(name);
nsCString bracketPart;
bool hadBracketPart = SplitLastSquareBracket(mutableName, bracketPart);