Backed out changeset 2422647220de (bug 1038899) for mochitest-2 bustage on a CLOSED TREE

This commit is contained in:
Wes Kocher 2014-08-07 19:08:10 -07:00
parent 5e66cf642c
commit 8d03f0b884
3 changed files with 30 additions and 52 deletions

View File

@ -1967,11 +1967,8 @@ WebGLContext::LinkProgram(WebGLProgram *program)
if (program == mCurrentProgram)
gl->fUseProgram(progname);
}
program->InitializeUniformAndAttributeMaps();
} else {
program->SetLinkStatus(false);
program->ClearUniformAndAttributeMaps();
if (ShouldGenerateWarnings()) {

View File

@ -14,10 +14,10 @@
using namespace mozilla;
/** Takes an ASCII string like "foo[i]", turns it into "foo" and returns "[i]" in bracketPart
*
*
* \param string input/output: the string to split, becomes the string without the bracket part
* \param bracketPart output: gets the bracket part.
*
*
* Notice that if there are multiple brackets like "foo[i].bar[j]", only the last bracket is split.
*/
static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart)
@ -133,38 +133,22 @@ WebGLProgram::UpperBoundNumSamplerUniforms() {
return numSamplerUniforms;
}
void
WebGLProgram::InitializeUniformAndAttributeMaps()
{
if (mIdentifierMap) {
mIdentifierMap->Clear();
} else {
mIdentifierMap = new CStringMap;
}
if (mIdentifierReverseMap) {
mIdentifierReverseMap->Clear();
} else {
mIdentifierReverseMap = new CStringMap;
}
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j];
mIdentifierMap->Put(attrib.original, attrib.mapped);
mIdentifierReverseMap->Put(attrib.mapped, attrib.original);
}
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
mIdentifierMap->Put(uniform.original, uniform.mapped);
mIdentifierReverseMap->Put(uniform.mapped, uniform.original);
}
}
}
void
WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) {
MOZ_ASSERT(mIdentifierMap);
if (!mIdentifierMap) {
// if the identifier map doesn't exist yet, build it now
mIdentifierMap = new CStringMap;
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j];
mIdentifierMap->Put(attrib.original, attrib.mapped);
}
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
mIdentifierMap->Put(uniform.original, uniform.mapped);
}
}
}
nsCString mutableName(name);
nsCString bracketPart;
@ -196,7 +180,20 @@ WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) {
void
WebGLProgram::ReverseMapIdentifier(const nsACString& name, nsCString *reverseMappedName) {
MOZ_ASSERT(mIdentifierReverseMap);
if (!mIdentifierReverseMap) {
// if the identifier reverse map doesn't exist yet, build it now
mIdentifierReverseMap = new CStringMap;
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j];
mIdentifierReverseMap->Put(attrib.mapped, attrib.original);
}
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
mIdentifierReverseMap->Put(uniform.mapped, uniform.original);
}
}
}
nsCString mutableName(name);
nsCString bracketPart;

View File

@ -81,22 +81,6 @@ public:
/* Getters for cached program info */
bool IsAttribInUse(unsigned i) const { return mAttribsInUse[i]; }
/* Initialize the maps used by MapIdentifier and ReverseMapIdentifier. This should
* be called after each time the program has been successfully linked.
*/
void InitializeUniformAndAttributeMaps();
/* Clear the maps used by MapIdentifier and ReverseMapIdentifier. This should be
* called each time the program has failed to link.
*/
void ClearUniformAndAttributeMaps() {
if (mIdentifierMap)
mIdentifierMap->Clear();
if (mIdentifierReverseMap)
mIdentifierReverseMap->Clear();
}
/* Maps identifier |name| to the mapped identifier |*mappedName|
* Both are ASCII strings.
*/