<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[279938] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/279938">279938</a></dd>
<dt>Author</dt> <dd>magomez@igalia.com</dd>
<dt>Date</dt> <dd>2021-07-15 01:08:24 -0700 (Thu, 15 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GStreamer][GL] A420 compositing support
https://bugs.webkit.org/show_bug.cgi?id=227953

Reviewed by Xabier Rodriguez-Calvar.

A420 is YUV+alpha in a separate component. vp9dec outputs this format for assets encoded
with alpha support. Our GL sink now supports this format and lets the TextureMapper handle the
final conversion to RGBA.

* platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
* platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp:
(WebCore::GstVideoFrameHolder::platformLayerBuffer):
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
(WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexturePlanarYUV):
* platform/graphics/texmap/TextureMapperGL.h:
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
(WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
* platform/graphics/texmap/TextureMapperShaderProgram.cpp:
(WebCore::TextureMapperShaderProgram::create):
* platform/graphics/texmap/TextureMapperShaderProgram.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerGLVideoSinkGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerGStreamerVideoFrameHoldercpp">trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerVideoTextureCopierGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperGLcpp">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperGLh">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperPlatformLayerBuffercpp">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperPlatformLayerBufferh">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramcpp">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramh">trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/ChangeLog      2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2021-07-15  Philippe Normand  <pnormand@igalia.com> and Miguel Gomez  <magomez@igalia.com>
+
+        [GStreamer][GL] A420 compositing support
+        https://bugs.webkit.org/show_bug.cgi?id=227953
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        A420 is YUV+alpha in a separate component. vp9dec outputs this format for assets encoded
+        with alpha support. Our GL sink now supports this format and lets the TextureMapper handle the
+        final conversion to RGBA.
+
+        * platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:
+        * platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp:
+        (WebCore::GstVideoFrameHolder::platformLayerBuffer):
+        * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
+        (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::drawTexturePlanarYUV):
+        * platform/graphics/texmap/TextureMapperGL.h:
+        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
+        (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
+        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
+        * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
+        (WebCore::TextureMapperShaderProgram::create):
+        * platform/graphics/texmap/TextureMapperShaderProgram.h:
+
</ins><span class="cx"> 2021-07-14  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Link against Catalyst ANGLE-shared.dylib when linking Catalyst WebCore.framework
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerGLVideoSinkGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp        2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp   2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> GST_DEBUG_CATEGORY_STATIC(webkit_gl_video_sink_debug);
</span><span class="cx"> #define GST_CAT_DEFAULT webkit_gl_video_sink_debug
</span><span class="cx"> 
</span><del>-#define GST_GL_CAPS_FORMAT "{ RGBx, RGBA, I420, Y444, YV12, Y41B, Y42B, NV12, NV21, VUYA }"
</del><ins>+#define GST_GL_CAPS_FORMAT "{ A420, RGBx, RGBA, I420, Y444, YV12, Y41B, Y42B, NV12, NV21, VUYA }"
</ins><span class="cx"> static GstStaticPadTemplate sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
</span><span class="cx"> 
</span><span class="cx"> #define webkit_gl_video_sink_parent_class parent_class
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerGStreamerVideoFrameHoldercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp   2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp      2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -182,7 +182,7 @@
</span><span class="cx">         return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { m_textureID } }, m_size, m_flags, GL_RGBA);
</span><span class="cx"> 
</span><span class="cx">     if (GST_VIDEO_INFO_IS_YUV(&m_videoFrame.info)) {
</span><del>-        if (GST_VIDEO_INFO_N_COMPONENTS(&m_videoFrame.info) < 3 || GST_VIDEO_INFO_N_PLANES(&m_videoFrame.info) > 3)
</del><ins>+        if (GST_VIDEO_INFO_N_COMPONENTS(&m_videoFrame.info) < 3 || GST_VIDEO_INFO_N_PLANES(&m_videoFrame.info) > 4)
</ins><span class="cx">             return nullptr;
</span><span class="cx"> 
</span><span class="cx">         if (m_videoDecoderPlatform && *m_videoDecoderPlatform == GstVideoDecoderPlatform::ImxVPU) {
</span><span class="lines">@@ -193,12 +193,12 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         unsigned numberOfPlanes = GST_VIDEO_INFO_N_PLANES(&m_videoFrame.info);
</span><del>-        std::array<GLuint, 3> planes;
-        std::array<unsigned, 3> yuvPlane;
-        std::array<unsigned, 3> yuvPlaneOffset;
</del><ins>+        std::array<GLuint, 4> planes;
+        std::array<unsigned, 4> yuvPlane;
+        std::array<unsigned, 4> yuvPlaneOffset;
</ins><span class="cx">         for (unsigned i = 0; i < numberOfPlanes; ++i)
</span><span class="cx">             planes[i] = *static_cast<GLuint*>(m_videoFrame.data[i]);
</span><del>-        for (unsigned i = 0; i < 3; ++i) {
</del><ins>+        for (unsigned i = 0; i < numberOfPlanes; ++i) {
</ins><span class="cx">             yuvPlane[i] = GST_VIDEO_INFO_COMP_PLANE(&m_videoFrame.info, i);
</span><span class="cx">             yuvPlaneOffset[i] = GST_VIDEO_INFO_COMP_POFFSET(&m_videoFrame.info, i);
</span><span class="cx">         }
</span><span class="lines">@@ -219,7 +219,7 @@
</span><span class="cx">             };
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return makeUnique<Buffer>( Buffer::TextureVariant { Buffer::YUVTexture { numberOfPlanes, planes, yuvPlane, yuvPlaneOffset, yuvToRgb } }, m_size, m_flags, GL_RGBA);
</del><ins>+        return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::YUVTexture { numberOfPlanes, planes, yuvPlane, yuvPlaneOffset, yuvToRgb } }, m_size, m_flags, GL_RGBA);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerVideoTextureCopierGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp 2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp    2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -177,6 +177,10 @@
</span><span class="cx">                 ASSERT(!texture.yuvPlaneOffset[0] && !texture.yuvPlaneOffset[1] && !texture.yuvPlaneOffset[2]);
</span><span class="cx">                 options = TextureMapperShaderProgram::TextureYUV;
</span><span class="cx">                 break;
</span><ins>+            case 4:
+                ASSERT(!texture.yuvPlaneOffset[0] && !texture.yuvPlaneOffset[1] && !texture.yuvPlaneOffset[2]);
+                options = TextureMapperShaderProgram::TextureYUVA;
+                break;
</ins><span class="cx">             }
</span><span class="cx">         },
</span><span class="cx">         [&](const Buffer::ExternalOESTexture&) {
</span><span class="lines">@@ -246,6 +250,12 @@
</span><span class="cx">                 glUniform1i(m_shaderProgram->samplerULocation(), texture.yuvPlane[1]);
</span><span class="cx">                 glUniform1i(m_shaderProgram->samplerVLocation(), texture.yuvPlane[2]);
</span><span class="cx">                 break;
</span><ins>+            case 4:
+                glUniform1i(m_shaderProgram->samplerYLocation(), texture.yuvPlane[0]);
+                glUniform1i(m_shaderProgram->samplerULocation(), texture.yuvPlane[1]);
+                glUniform1i(m_shaderProgram->samplerVLocation(), texture.yuvPlane[2]);
+                glUniform1i(m_shaderProgram->samplerALocation(), texture.yuvPlane[3]);
+                break;
</ins><span class="cx">             }
</span><span class="cx">             glUniformMatrix3fv(m_shaderProgram->yuvToRgbLocation(), 1, GL_FALSE, static_cast<const GLfloat *>(&texture.yuvToRgbMatrix[0]));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp        2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp   2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -540,7 +540,7 @@
</span><span class="cx">         patternTransform.translate(0, -1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextureMapperGL::drawTexturePlanarYUV(const std::array<GLuint, 3>& textures, const std::array<GLfloat, 9>& yuvToRgbMatrix, Flags flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges)
</del><ins>+void TextureMapperGL::drawTexturePlanarYUV(const std::array<GLuint, 3>& textures, const std::array<GLfloat, 9>& yuvToRgbMatrix, Flags flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, std::optional<GLuint> alphaPlane, unsigned exposedEdges)
</ins><span class="cx"> {
</span><span class="cx">     bool useRect = flags & ShouldUseARBTextureRect;
</span><span class="cx">     bool useAntialiasing = m_enableEdgeDistanceAntialiasing
</span><span class="lines">@@ -547,7 +547,7 @@
</span><span class="cx">         && exposedEdges == AllEdges
</span><span class="cx">         && !modelViewMatrix.mapQuad(targetRect).isRectilinear();
</span><span class="cx"> 
</span><del>-    TextureMapperShaderProgram::Options options = TextureMapperShaderProgram::TextureYUV;
</del><ins>+    TextureMapperShaderProgram::Options options = alphaPlane ? TextureMapperShaderProgram::TextureYUVA : TextureMapperShaderProgram::TextureYUV;
</ins><span class="cx">     if (useRect)
</span><span class="cx">         options |= TextureMapperShaderProgram::Rect;
</span><span class="cx">     if (opacity < 1)
</span><span class="lines">@@ -578,6 +578,9 @@
</span><span class="cx">         flags |= ShouldBlend;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (flags & ShouldPremultiply)
+        options |= TextureMapperShaderProgram::Premultiply;
+
</ins><span class="cx">     Ref<TextureMapperShaderProgram> program = data().getShaderProgram(options);
</span><span class="cx"> 
</span><span class="cx">     if (filter)
</span><span class="lines">@@ -592,6 +595,9 @@
</span><span class="cx">         { textures[2], program->samplerVLocation() }
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    if (alphaPlane)
+        texturesAndSamplers.append({*alphaPlane, program->samplerALocation() });
+
</ins><span class="cx">     glUseProgram(program->programID());
</span><span class="cx">     glUniformMatrix3fv(program->yuvToRgbLocation(), 1, GL_FALSE, static_cast<const GLfloat *>(&yuvToRgbMatrix[0]));
</span><span class="cx">     drawTexturedQuadWithProgram(program.get(), texturesAndSamplers, flags, textureSize, targetRect, modelViewMatrix, opacity);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperGLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h  2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h     2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     void drawNumber(int number, const Color&, const FloatPoint&, const TransformationMatrix&) override;
</span><span class="cx">     void drawTexture(const BitmapTexture&, const FloatRect&, const TransformationMatrix&, float opacity, unsigned exposedEdges) override;
</span><span class="cx">     virtual void drawTexture(GLuint texture, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges = AllEdges);
</span><del>-    void drawTexturePlanarYUV(const std::array<GLuint, 3>& textures, const std::array<GLfloat, 9>& yuvToRgbMatrix, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges = AllEdges);
</del><ins>+    void drawTexturePlanarYUV(const std::array<GLuint, 3>& textures, const std::array<GLfloat, 9>& yuvToRgbMatrix, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, std::optional<GLuint> alphaPlane, unsigned exposedEdges = AllEdges);
</ins><span class="cx">     void drawTextureSemiPlanarYUV(const std::array<GLuint, 2>& textures, bool uvReversed, const std::array<GLfloat, 9>& yuvToRgbMatrix, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges = AllEdges);
</span><span class="cx">     void drawTexturePackedYUV(GLuint texture, const std::array<GLfloat, 9>& yuvToRgbMatrix, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, unsigned exposedEdges = AllEdges);
</span><span class="cx">     void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&, bool) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperPlatformLayerBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp       2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp  2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -143,8 +143,13 @@
</span><span class="cx">             case 3:
</span><span class="cx">                 ASSERT(!texture.yuvPlaneOffset[0] && !texture.yuvPlaneOffset[1] && !texture.yuvPlaneOffset[2]);
</span><span class="cx">                 texmapGL.drawTexturePlanarYUV(std::array<GLuint, 3> { texture.planes[texture.yuvPlane[0]], texture.planes[texture.yuvPlane[1]], texture.planes[texture.yuvPlane[2]] },
</span><del>-                    texture.yuvToRgbMatrix, m_extraFlags, m_size, targetRect, modelViewMatrix, opacity);
</del><ins>+                    texture.yuvToRgbMatrix, m_extraFlags, m_size, targetRect, modelViewMatrix, opacity, std::nullopt);
</ins><span class="cx">                 break;
</span><ins>+            case 4:
+                ASSERT(!texture.yuvPlaneOffset[0] && !texture.yuvPlaneOffset[1] && !texture.yuvPlaneOffset[2]);
+                texmapGL.drawTexturePlanarYUV(std::array<GLuint, 3> { texture.planes[texture.yuvPlane[0]], texture.planes[texture.yuvPlane[1]], texture.planes[texture.yuvPlane[2]] },
+                    texture.yuvToRgbMatrix, m_extraFlags, m_size, targetRect, modelViewMatrix, opacity, texture.planes[texture.yuvPlane[3]]);
+                break;
</ins><span class="cx">             }
</span><span class="cx">         },
</span><span class="cx">         [&](const ExternalOESTexture& texture) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperPlatformLayerBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h 2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h    2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx">     };
</span><span class="cx">     struct YUVTexture {
</span><span class="cx">         unsigned numberOfPlanes;
</span><del>-        std::array<GLuint, 3> planes;
-        std::array<unsigned, 3> yuvPlane;
-        std::array<unsigned, 3> yuvPlaneOffset;
</del><ins>+        std::array<GLuint, 4> planes;
+        std::array<unsigned, 4> yuvPlane;
+        std::array<unsigned, 4> yuvPlaneOffset;
</ins><span class="cx">         std::array<GLfloat, 9> yuvToRgbMatrix;
</span><span class="cx">     };
</span><span class="cx">     struct ExternalOESTexture {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp     2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp        2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -233,6 +233,7 @@
</span><span class="cx">         uniform SamplerType s_samplerY;
</span><span class="cx">         uniform SamplerType s_samplerU;
</span><span class="cx">         uniform SamplerType s_samplerV;
</span><ins>+        uniform SamplerType s_samplerA;
</ins><span class="cx">         uniform sampler2D s_contentTexture;
</span><span class="cx">         uniform SamplerExternalOESType s_externalOESTexture;
</span><span class="cx">         uniform float u_opacity;
</span><span class="lines">@@ -280,6 +281,15 @@
</span><span class="cx">             vec4 data = vec4(yuvToRgb(y, u, v), 1.0);
</span><span class="cx">             color = u_textureColorSpaceMatrix * data;
</span><span class="cx">         }
</span><ins>+        void applyTextureYUVA(inout vec4 color, vec2 texCoord)
+        {
+            float y = SamplerFunction(s_samplerY, texCoord).r;
+            float u = SamplerFunction(s_samplerU, texCoord).r;
+            float v = SamplerFunction(s_samplerV, texCoord).r;
+            float a = SamplerFunction(s_samplerA, texCoord).r;
+            vec4 data = vec4(yuvToRgb(y, u, v), a);
+            color = u_textureColorSpaceMatrix * data;
+        }
</ins><span class="cx">         void applyTextureNV12(inout vec4 color, vec2 texCoord)
</span><span class="cx">         {
</span><span class="cx">             float y = SamplerFunction(s_samplerY, texCoord).r;
</span><span class="lines">@@ -485,11 +495,12 @@
</span><span class="cx">             vec2 texCoord = transformTexCoord();
</span><span class="cx">             applyManualRepeatIfNeeded(texCoord);
</span><span class="cx">             applyTextureRGBIfNeeded(color, texCoord);
</span><del>-            applyPremultiplyIfNeeded(color);
</del><span class="cx">             applyTextureYUVIfNeeded(color, texCoord);
</span><ins>+            applyTextureYUVAIfNeeded(color, texCoord);
</ins><span class="cx">             applyTextureNV12IfNeeded(color, texCoord);
</span><span class="cx">             applyTextureNV21IfNeeded(color, texCoord);
</span><span class="cx">             applyTexturePackedYUVIfNeeded(color, texCoord);
</span><ins>+            applyPremultiplyIfNeeded(color);
</ins><span class="cx">             applySolidColorIfNeeded(color);
</span><span class="cx">             applyAntialiasingIfNeeded(color);
</span><span class="cx">             applyOpacityIfNeeded(color);
</span><span class="lines">@@ -519,6 +530,7 @@
</span><span class="cx">     StringBuilder optionsApplierBuilder;
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(TextureRGB);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(TextureYUV);
</span><ins>+    SET_APPLIER_FROM_OPTIONS(TextureYUVA);
</ins><span class="cx">     SET_APPLIER_FROM_OPTIONS(TextureNV12);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(TextureNV21);
</span><span class="cx">     SET_APPLIER_FROM_OPTIONS(TexturePackedYUV);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapTextureMapperShaderProgramh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h (279937 => 279938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h       2021-07-15 03:11:53 UTC (rev 279937)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h  2021-07-15 08:08:24 UTC (rev 279938)
</span><span class="lines">@@ -50,16 +50,17 @@
</span><span class="cx">     macro(shadowOffset) \
</span><span class="cx">     macro(roundedRectNumber) \
</span><span class="cx">     macro(roundedRect) \
</span><del>-    macro(roundedRectInverseTransformMatrix) \
</del><ins>+    macro(roundedRectInverseTransformMatrix)
</ins><span class="cx"> 
</span><del>-#define TEXMAP_SAMPLER_VARIABLES(macro) \
-    macro(sampler) \
-    macro(samplerY) \
-    macro(samplerU) \
-    macro(samplerV) \
-    macro(mask) \
-    macro(contentTexture) \
-    macro(externalOESTexture) \
</del><ins>+#define TEXMAP_SAMPLER_VARIABLES(macro)           \
+    macro(sampler)                                \
+    macro(samplerY)                               \
+    macro(samplerU)                               \
+    macro(samplerV)                               \
+    macro(samplerA)                               \
+    macro(mask)                                   \
+    macro(contentTexture)                         \
+    macro(externalOESTexture)
</ins><span class="cx"> 
</span><span class="cx"> #define TEXMAP_VARIABLES(macro) \
</span><span class="cx">     TEXMAP_ATTRIBUTE_VARIABLES(macro) \
</span><span class="lines">@@ -104,6 +105,7 @@
</span><span class="cx">         TextureExternalOES = 1L << 22,
</span><span class="cx">         RoundedRectClip  = 1L << 23,
</span><span class="cx">         Premultiply      = 1L << 24,
</span><ins>+        TextureYUVA      = 1L << 25,
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     enum class VariableID {
</span></span></pre>
</div>
</div>

</body>
</html>