Backed out changeset 2422647220de (bug 1038899) for mochitest-2 bustage on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 07 Aug 2014 19:08:10 -0700
changeset 220097 d1865a8e16d3c27c672498837d9ef369812cfa3c
parent 220096 b065f0ebf575e61403206ee696792843611de37f
child 220098 5a9241e29c61509b85c9e39271a601e5379f8bb9
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1038899
milestone34.0a1
backs out2422647220de241b23d6e95ac6bcd594ece846a2
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 2422647220de (bug 1038899) for mochitest-2 bustage on a CLOSED TREE
dom/canvas/WebGLContextGL.cpp
dom/canvas/WebGLProgram.cpp
dom/canvas/WebGLProgram.h
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1962,21 +1962,18 @@ WebGLContext::LinkProgram(WebGLProgram *
         // Bug 750527
         if (gl->WorkAroundDriverBugs() &&
             updateInfoSucceeded &&
             gl->Vendor() == gl::GLVendor::NVIDIA)
         {
             if (program == mCurrentProgram)
                 gl->fUseProgram(progname);
         }
-
-        program->InitializeUniformAndAttributeMaps();
     } else {
         program->SetLinkStatus(false);
-        program->ClearUniformAndAttributeMaps();
 
         if (ShouldGenerateWarnings()) {
 
             // report shader/program infoLogs as warnings.
             // note that shader compilation errors can be deferred to linkProgram,
             // which is why we can't do anything in compileShader. In practice we could
             // report in compileShader the translation errors generated by ANGLE,
             // but it seems saner to keep a single way of obtaining shader infologs.
--- a/dom/canvas/WebGLProgram.cpp
+++ b/dom/canvas/WebGLProgram.cpp
@@ -9,20 +9,20 @@
 #include "mozilla/dom/WebGLRenderingContextBinding.h"
 #include "GLContext.h"
 
 #include "MurmurHash3.h"
 
 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)
 {
     MOZ_ASSERT(bracketPart.IsEmpty(), "SplitLastSquareBracket must be called with empty bracketPart string");
 
     if (string.IsEmpty())
         return false;
@@ -129,47 +129,31 @@ WebGLProgram::UpperBoundNumSamplerUnifor
                 numSamplerUniforms += u.arraySize;
             }
         }
     }
     return numSamplerUniforms;
 }
 
 void
-WebGLProgram::InitializeUniformAndAttributeMaps()
-{
-    if (mIdentifierMap) {
-        mIdentifierMap->Clear();
-    } else {
+WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) {
+    if (!mIdentifierMap) {
+        // if the identifier map doesn't exist yet, build it now
         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);
+        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);
+            }
         }
     }
-}
-
-void
-WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) {
-    MOZ_ASSERT(mIdentifierMap);
 
     nsCString mutableName(name);
     nsCString bracketPart;
     bool hadBracketPart = SplitLastSquareBracket(mutableName, bracketPart);
     if (hadBracketPart)
         mutableName.AppendLiteral("[0]");
 
     if (mIdentifierMap->Get(mutableName, mappedName)) {
@@ -191,17 +175,30 @@ WebGLProgram::MapIdentifier(const nsACSt
     // not found? return name unchanged. This case happens e.g. on bad user input, or when
     // we're not using identifier mapping, or if we didn't store an identifier in the map because
     // e.g. its mapping is trivial (as happens for short identifiers)
     mappedName->Assign(name);
 }
 
 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;
     bool hadBracketPart = SplitLastSquareBracket(mutableName, bracketPart);
     if (hadBracketPart)
         mutableName.AppendLiteral("[0]");
 
     if (mIdentifierReverseMap->Get(mutableName, reverseMappedName)) {
--- a/dom/canvas/WebGLProgram.h
+++ b/dom/canvas/WebGLProgram.h
@@ -76,32 +76,16 @@ public:
     }
 
     /* Called only after LinkProgram */
     bool UpdateInfo();
 
     /* 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.
      */
     void MapIdentifier(const nsACString& name, nsCString *mappedName);
 
     /* Un-maps mapped identifier |name| to the original identifier |*reverseMappedName|
      * Both are ASCII strings.
      */