Bug 1128044 - nsTArray::AppendElement doesn't accept init lists. - r=bustage
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 11 Mar 2015 21:21:03 -0700
changeset 251597 d4cfb9e9de85aa0cc99a9cc5ac7bc18833bd1cbf
parent 251596 acf73f2ea7d905fba22d3be06338757e3fd76dda
child 251598 b7027d5ce2fe72f897921a01bac061e84a06aac4
push id7860
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:46:02 +0000
treeherdermozilla-aurora@8ac636cd51f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1128044
milestone39.0a1
Bug 1128044 - nsTArray::AppendElement doesn't accept init lists. - r=bustage
dom/canvas/WebGLShaderValidator.cpp
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -219,22 +219,23 @@ ShaderValidator::CanLinkTo(const ShaderV
     }
     {
         const std::vector<sh::Varying>& vertList = *ShGetVaryings(prev->mHandle);
         const std::vector<sh::Varying>& fragList = *ShGetVaryings(mHandle);
 
         nsTArray<ShVariableInfo> staticUseVaryingList;
 
         for (auto itrFrag = fragList.begin(); itrFrag != fragList.end(); ++itrFrag) {
+            const ShVariableInfo varInfo = { itrFrag->type,
+                                             (int)itrFrag->elementCount() };
+
             static const char prefix[] = "gl_";
             if (StartsWith(itrFrag->name, prefix)) {
-                if (itrFrag->staticUse) {
-                    staticUseVaryingList.AppendElement({itrFrag->type,
-                                                        (int)itrFrag->elementCount()});
-                }
+                if (itrFrag->staticUse)
+                    staticUseVaryingList.AppendElement(varInfo);
 
                 continue;
             }
 
             bool definedInVertShader = false;
             bool staticVertUse = false;
 
             for (auto itrVert = vertList.begin(); itrVert != vertList.end(); ++itrVert) {
@@ -257,20 +258,18 @@ ShaderValidator::CanLinkTo(const ShaderV
             if (!definedInVertShader && itrFrag->staticUse) {
                 nsPrintfCString error("Varying `%s` has static-use in the frag"
                                       " shader, but is undeclared in the vert"
                                       " shader.", itrFrag->name.c_str());
                 *out_log = error;
                 return false;
             }
 
-            if (staticVertUse && itrFrag->staticUse) {
-                staticUseVaryingList.AppendElement({itrFrag->type,
-                                                    (int)itrFrag->elementCount()});
-            }
+            if (staticVertUse && itrFrag->staticUse)
+                staticUseVaryingList.AppendElement(varInfo);
         }
 
         if (!ShCheckVariablesWithinPackingLimits(mMaxVaryingVectors,
                                                  staticUseVaryingList.Elements(),
                                                  staticUseVaryingList.Length()))
         {
             *out_log = "Statically used varyings do not fit within packing limits. (see"
                        " GLSL ES Specification 1.0.17, p111)";