Bug 1323617 - Don't assert for performance trap when srcPremult == dstPremult, even if the formats allow us to skip premult. - r=ethlin draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 15 Dec 2016 15:50:35 -0800
changeset 450533 b35154d153ad22a6f54459aa5d685c941a55fd05
parent 450532 5146d7a101a4cfb8857f29835c0595ce9d52d808
child 539776 35fee5c20163c8f584b60694db27e6e9ed709696
push id38882
push userbmo:jgilbert@mozilla.com
push dateFri, 16 Dec 2016 21:59:10 +0000
reviewersethlin
bugs1323617
milestone53.0a1
Bug 1323617 - Don't assert for performance trap when srcPremult == dstPremult, even if the formats allow us to skip premult. - r=ethlin MozReview-Commit-ID: 4OIdz48KhfH
dom/canvas/WebGLTexelConversions.cpp
--- a/dom/canvas/WebGLTexelConversions.cpp
+++ b/dom/canvas/WebGLTexelConversions.cpp
@@ -394,17 +394,21 @@ ConvertImage(size_t width, size_t height
         //
         // The case where absolutely nothing needs to be done is supposed to have
         // been handled earlier (in TexImage2D_base, etc).
         //
         // So the case we're handling here is when even though no format conversion is
         // needed, we still might have to flip vertically and/or to adjust to a different
         // stride.
 
-        MOZ_ASSERT(shouldYFlip || srcStride != dstStride,
+        // We ignore canSkipPremult for this perf trap, since it's an avoidable perf cliff
+        // under the WebGL API user's control.
+        MOZ_ASSERT((srcPremultiplied != dstPremultiplied ||
+                    shouldYFlip ||
+                    srcStride != dstStride),
                    "Performance trap -- should handle this case earlier to avoid memcpy");
 
         const auto bytesPerPixel = TexelBytesForFormat(srcFormat);
         const size_t bytesPerRow = bytesPerPixel * width;
 
         while (srcItr != srcEnd) {
             memcpy(dstItr, srcItr, bytesPerRow);
             srcItr += srcStride;