Title: [231084] trunk/Source/WebCore
- Revision
- 231084
- Author
- [email protected]
- Date
- 2018-04-26 19:00:25 -0700 (Thu, 26 Apr 2018)
Log Message
tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
https://bugs.webkit.org/show_bug.cgi?id=184843
<rdar://problem/34898868>
Patch by Justin Fan <[email protected]> on 2018-04-26
Reviewed by Simon Fraser.
On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread.
For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8.
This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these.
* platform/graphics/FormatConverter.cpp:
(WebCore::FormatConverter::convert):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (231083 => 231084)
--- trunk/Source/WebCore/ChangeLog 2018-04-27 01:25:10 UTC (rev 231083)
+++ trunk/Source/WebCore/ChangeLog 2018-04-27 02:00:25 UTC (rev 231084)
@@ -1,3 +1,18 @@
+2018-04-26 Justin Fan <[email protected]>
+
+ tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
+ https://bugs.webkit.org/show_bug.cgi?id=184843
+ <rdar://problem/34898868>
+
+ Reviewed by Simon Fraser.
+
+ On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread.
+ For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8.
+ This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these.
+
+ * platform/graphics/FormatConverter.cpp:
+ (WebCore::FormatConverter::convert):
+
2018-04-26 Simon Fraser <[email protected]>
Implement rendering support for the color-filter CSS property
Modified: trunk/Source/WebCore/platform/graphics/FormatConverter.cpp (231083 => 231084)
--- trunk/Source/WebCore/platform/graphics/FormatConverter.cpp 2018-04-27 01:25:10 UTC (rev 231083)
+++ trunk/Source/WebCore/platform/graphics/FormatConverter.cpp 2018-04-27 02:00:25 UTC (rev 231084)
@@ -35,6 +35,10 @@
#include "GraphicsContext3DNEON.h"
#endif
+#if USE(ACCELERATE)
+#include <Accelerate/Accelerate.h>
+#endif
+
namespace WebCore {
@@ -1241,6 +1245,9 @@
const SrcType *srcRowStart = static_cast<const SrcType*>(m_srcStart);
DstType* dstRowStart = static_cast<DstType*>(m_dstStart);
+
+ m_success = true;
+
if (!trivialUnpack && trivialPack) {
for (size_t i = 0; i < m_height; ++i) {
unpack<SrcFormat>(srcRowStart, dstRowStart, m_width);
@@ -1255,6 +1262,27 @@
dstRowStart += dstStrideInElements;
}
} else {
+#if USE(ACCELERATE)
+ if (SrcFormat == GraphicsContext3D::DataFormatRGBA8
+ && DstFormat == GraphicsContext3D::DataFormatRGBA8
+ && alphaOp == GraphicsContext3D::AlphaDoUnmultiply) {
+ vImage_Buffer src;
+ src.width = m_width;
+ src.height = m_height;
+ src.rowBytes = m_srcStride;
+ src.data = ""
+
+ vImage_Buffer dst;
+ dst.width = m_width;
+ dst.height = m_height;
+ dst.rowBytes = m_dstStride;
+ dst.data = ""
+
+ vImageUnpremultiplyData_RGBA8888(&src, &dst, kvImageNoFlags);
+
+ return;
+ }
+#endif
for (size_t i = 0; i < m_height; ++i) {
pack<DstFormat, alphaOp>(srcRowStart, dstRowStart, m_width);
srcRowStart += srcStrideInElements;
@@ -1261,8 +1289,6 @@
dstRowStart += dstStrideInElements;
}
}
- m_success = true;
- return;
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes