<!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>[286175] 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/286175">286175</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-11-26 03:11:33 -0800 (Fri, 26 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>GraphicsContextGLOpenGL.cpp contains OpenGL implementation specific and platform specific code
https://bugs.webkit.org/show_bug.cgi?id=233513

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-11-26
Reviewed by Antti Koivisto.

Move duplicate functionality of "context changed, context not changed" from
  - GraphicsContextGLOpenGL ANGLE variant
  - GraphicsContextGLOpenGL OpenGL, OpenGL ES variant
  - RemoteGraphicsContextGLProxyBase
to base class GraphicsContextGL. In order to do this, add few WEBCORE_EXPORTs to
GraphicsContextGL.h, since RemoteGraphicsContextGLProxyBase is in WebKit and needs to call
the base-class versions as well as use vtable.

Move ANGLE-specific functions from GraphicsContextGLOpenGL.cpp to GraphicsContextGLANGLE.cpp.
Move TextureMapper-specific functions from GraphicsContextGLOpenGL.cpp to GraphicsContextGLTextureMapper.cpp.
Move OpenGL, OpenGL ES specific functions from GraphicsContextGLOpenGL.cpp to GraphicsContextGLOpenGLCommon.cpp.

This works towards being able to separate ANGLE and OpenGL, OpenGL ES implementations to different classes,
reducing the ifdeffing in GraphicsContextGLOpenGL.h.

No new tests, refactor.

* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::markContextChanged):
(WebCore::GraphicsContextGL::layerComposited const):
(WebCore::GraphicsContextGL::setBuffersToAutoClear):
(WebCore::GraphicsContextGL::getBuffersToAutoClear const):
(WebCore::GraphicsContextGL::markLayerComposited):
* platform/graphics/GraphicsContextGL.h:
(WebCore::GraphicsContextGL::Client::~Client): Deleted.
* platform/graphics/RemoteGraphicsContextGLProxyBase.cpp:
(WebCore::RemoteGraphicsContextGLProxyBase::markContextChanged):
(WebCore::RemoteGraphicsContextGLProxyBase::markLayerComposited): Deleted.
(WebCore::RemoteGraphicsContextGLProxyBase::layerComposited const): Deleted.
(WebCore::RemoteGraphicsContextGLProxyBase::setBuffersToAutoClear): Deleted.
(WebCore::RemoteGraphicsContextGLProxyBase::getBuffersToAutoClear const): Deleted.
* platform/graphics/RemoteGraphicsContextGLProxyBase.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::markContextChanged): Deleted.
(WebCore::GraphicsContextGLOpenGL::markLayerComposited): Deleted.
(WebCore::GraphicsContextGLOpenGL::layerComposited const): Deleted.
* platform/graphics/cocoa/GraphicsContextGLCocoa.h:
* platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::GraphicsContextGLCocoa::copyTextureFromMedia):
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
(WebCore::GraphicsContextGLOpenGL::resetBuffersToAutoClear): Deleted.
(WebCore::GraphicsContextGLOpenGL::setBuffersToAutoClear): Deleted.
(WebCore::GraphicsContextGLOpenGL::getBuffersToAutoClear const): Deleted.
(WebCore::GraphicsContextGLOpenGL::releaseThreadResources): Deleted.
(WebCore::GraphicsContextGLOpenGL::platformReleaseThreadResources): Deleted.
(WebCore::GraphicsContextGLOpenGL::texImage2DResourceSafe): Deleted.
(WebCore::GraphicsContextGLOpenGL::setContextVisibility): Deleted.
(WebCore::GraphicsContextGLOpenGL::simulateEventForTesting): Deleted.
(WebCore::GraphicsContextGLOpenGL::prepareForDisplay): Deleted.
(WebCore::GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample): Deleted.
(WebCore::GraphicsContextGLOpenGL::readCompositedResults): Deleted.
(WebCore::GraphicsContextGLOpenGL::copyTextureFromMedia): Deleted.
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::texImage2DResourceSafe):
(WebCore::GraphicsContextGLOpenGL::markContextChanged): Deleted.
(WebCore::GraphicsContextGLOpenGL::markLayerComposited): Deleted.
(WebCore::GraphicsContextGLOpenGL::layerComposited const): Deleted.
* platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
(WebCore::GraphicsContextGLOpenGL::setContextVisibility):
(WebCore::GraphicsContextGLOpenGL::simulateEventForTesting):
(WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
(WebCore::GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample):
(WebCore::GraphicsContextGLOpenGL::readCompositedResults):
(WebCore::GraphicsContextGLTextureMapper::copyTextureFromMedia):
* platform/graphics/texmap/GraphicsContextGLTextureMapper.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextGLcpp">trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextGLh">trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsRemoteGraphicsContextGLProxyBasecpp">trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsRemoteGraphicsContextGLProxyBaseh">trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsangleGraphicsContextGLANGLEcpp">trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaGraphicsContextGLCocoah">trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaGraphicsContextGLCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLcpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLh">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLCommoncpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapGraphicsContextGLTextureMappercpp">trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapGraphicsContextGLTextureMapperh">trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/ChangeLog      2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2021-11-26  Kimmo Kinnunen  <kkinnunen@apple.com>
+
+        GraphicsContextGLOpenGL.cpp contains OpenGL implementation specific and platform specific code
+        https://bugs.webkit.org/show_bug.cgi?id=233513
+
+        Reviewed by Antti Koivisto.
+
+        Move duplicate functionality of "context changed, context not changed" from
+          - GraphicsContextGLOpenGL ANGLE variant
+          - GraphicsContextGLOpenGL OpenGL, OpenGL ES variant
+          - RemoteGraphicsContextGLProxyBase
+        to base class GraphicsContextGL. In order to do this, add few WEBCORE_EXPORTs to
+        GraphicsContextGL.h, since RemoteGraphicsContextGLProxyBase is in WebKit and needs to call
+        the base-class versions as well as use vtable.
+
+        Move ANGLE-specific functions from GraphicsContextGLOpenGL.cpp to GraphicsContextGLANGLE.cpp.
+        Move TextureMapper-specific functions from GraphicsContextGLOpenGL.cpp to GraphicsContextGLTextureMapper.cpp.
+        Move OpenGL, OpenGL ES specific functions from GraphicsContextGLOpenGL.cpp to GraphicsContextGLOpenGLCommon.cpp.
+
+        This works towards being able to separate ANGLE and OpenGL, OpenGL ES implementations to different classes,
+        reducing the ifdeffing in GraphicsContextGLOpenGL.h.
+
+        No new tests, refactor.
+
+        * platform/graphics/GraphicsContextGL.cpp:
+        (WebCore::GraphicsContextGL::markContextChanged):
+        (WebCore::GraphicsContextGL::layerComposited const):
+        (WebCore::GraphicsContextGL::setBuffersToAutoClear):
+        (WebCore::GraphicsContextGL::getBuffersToAutoClear const):
+        (WebCore::GraphicsContextGL::markLayerComposited):
+        * platform/graphics/GraphicsContextGL.h:
+        (WebCore::GraphicsContextGL::Client::~Client): Deleted.
+        * platform/graphics/RemoteGraphicsContextGLProxyBase.cpp:
+        (WebCore::RemoteGraphicsContextGLProxyBase::markContextChanged):
+        (WebCore::RemoteGraphicsContextGLProxyBase::markLayerComposited): Deleted.
+        (WebCore::RemoteGraphicsContextGLProxyBase::layerComposited const): Deleted.
+        (WebCore::RemoteGraphicsContextGLProxyBase::setBuffersToAutoClear): Deleted.
+        (WebCore::RemoteGraphicsContextGLProxyBase::getBuffersToAutoClear const): Deleted.
+        * platform/graphics/RemoteGraphicsContextGLProxyBase.h:
+        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+        (WebCore::GraphicsContextGLOpenGL::markContextChanged): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::markLayerComposited): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::layerComposited const): Deleted.
+        * platform/graphics/cocoa/GraphicsContextGLCocoa.h:
+        * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
+        (WebCore::GraphicsContextGLCocoa::copyTextureFromMedia):
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+        (WebCore::GraphicsContextGLOpenGL::resetBuffersToAutoClear): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::setBuffersToAutoClear): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::getBuffersToAutoClear const): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::releaseThreadResources): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::platformReleaseThreadResources): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::texImage2DResourceSafe): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::setContextVisibility): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::simulateEventForTesting): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::prepareForDisplay): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::readCompositedResults): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::copyTextureFromMedia): Deleted.
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+        * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
+        (WebCore::GraphicsContextGLOpenGL::texImage2DResourceSafe):
+        (WebCore::GraphicsContextGLOpenGL::markContextChanged): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::markLayerComposited): Deleted.
+        (WebCore::GraphicsContextGLOpenGL::layerComposited const): Deleted.
+        * platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
+        (WebCore::GraphicsContextGLOpenGL::setContextVisibility):
+        (WebCore::GraphicsContextGLOpenGL::simulateEventForTesting):
+        (WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
+        (WebCore::GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample):
+        (WebCore::GraphicsContextGLOpenGL::readCompositedResults):
+        (WebCore::GraphicsContextGLTextureMapper::copyTextureFromMedia):
+        * platform/graphics/texmap/GraphicsContextGLTextureMapper.h:
+
</ins><span class="cx"> 2021-11-26  Tim Nguyen  <ntim@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Update dialog focusing steps inert/disconnected handling
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp     2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp        2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -347,6 +347,10 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+GraphicsContextGL::Client::Client() = default;
+
+GraphicsContextGL::Client::~Client() = default;
+
</ins><span class="cx"> RefPtr<GraphicsContextGL> GraphicsContextGL::create(const GraphicsContextGLAttributes& attributes, HostWindow* hostWindow)
</span><span class="cx"> {
</span><span class="cx">     RefPtr<GraphicsContextGL> result;
</span><span class="lines">@@ -362,6 +366,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+GraphicsContextGL::~GraphicsContextGL() = default;
</ins><span class="cx"> 
</span><span class="cx"> bool GraphicsContextGL::computeFormatAndTypeParameters(GCGLenum format, GCGLenum type, unsigned* componentsPerPixel, unsigned* bytesPerComponent)
</span><span class="cx"> {
</span><span class="lines">@@ -607,6 +612,42 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContextGL::markContextChanged()
+{
+    m_layerComposited = false;
+}
+
+bool GraphicsContextGL::layerComposited() const
+{
+    return m_layerComposited;
+}
+
+void GraphicsContextGL::setBuffersToAutoClear(GCGLbitfield buffers)
+{
+    if (!contextAttributes().preserveDrawingBuffer)
+        m_buffersToAutoClear = buffers;
+}
+
+GCGLbitfield GraphicsContextGL::getBuffersToAutoClear() const
+{
+    return m_buffersToAutoClear;
+}
+
+void GraphicsContextGL::markLayerComposited()
+{
+    m_layerComposited = true;
+    auto attrs = contextAttributes();
+    if (!attrs.preserveDrawingBuffer) {
+        m_buffersToAutoClear = GraphicsContextGL::COLOR_BUFFER_BIT;
+        if (attrs.depth)
+            m_buffersToAutoClear |= GraphicsContextGL::DEPTH_BUFFER_BIT;
+        if (attrs.stencil)
+            m_buffersToAutoClear |= GraphicsContextGL::STENCIL_BUFFER_BIT;
+    }
+    for (auto* client : copyToVector(m_clients))
+        client->didComposite();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextGLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h       2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h  2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -897,7 +897,8 @@
</span><span class="cx"> 
</span><span class="cx">     class Client {
</span><span class="cx">     public:
</span><del>-        virtual ~Client() { }
</del><ins>+        WEBCORE_EXPORT Client();
+        WEBCORE_EXPORT virtual ~Client();
</ins><span class="cx">         virtual void didComposite() = 0;
</span><span class="cx">         virtual void forceContextLost() = 0;
</span><span class="cx">         virtual void recycleContext() = 0;
</span><span class="lines">@@ -914,8 +915,8 @@
</span><span class="cx">     // HostWindow might affect the decision which backend is to be used.
</span><span class="cx">     WEBCORE_EXPORT static RefPtr<GraphicsContextGL> create(const GraphicsContextGLAttributes&, HostWindow*);
</span><span class="cx"> 
</span><del>-    GraphicsContextGL(GraphicsContextGLAttributes);
-    virtual ~GraphicsContextGL() = default;
</del><ins>+    WEBCORE_EXPORT GraphicsContextGL(GraphicsContextGLAttributes);
+    WEBCORE_EXPORT virtual ~GraphicsContextGL();
</ins><span class="cx"> 
</span><span class="cx">     void addClient(Client& client) { m_clients.add(&client); }
</span><span class="cx">     void removeClient(Client& client) { m_clients.remove(&client); }
</span><span class="lines">@@ -1274,14 +1275,14 @@
</span><span class="cx">     virtual void prepareForDisplay() = 0;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: should be removed, caller should keep track of changed state.
</span><del>-    virtual void markContextChanged() = 0;
</del><ins>+    WEBCORE_EXPORT virtual void markContextChanged();
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: these should be removed, caller is interested in buffer clear status and
</span><span class="cx">     // should track that in a variable that the caller holds. Caller should receive
</span><span class="cx">     // the value from reshape() and didComposite().
</span><del>-    virtual bool layerComposited() const = 0;
-    virtual void setBuffersToAutoClear(GCGLbitfield) = 0;
-    virtual GCGLbitfield getBuffersToAutoClear() const = 0;
</del><ins>+    bool layerComposited() const;
+    void setBuffersToAutoClear(GCGLbitfield);
+    GCGLbitfield getBuffersToAutoClear() const;
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: these should be removed, they're part of drawing buffer and
</span><span class="cx">     // display buffer abstractions that the caller should hold separate to
</span><span class="lines">@@ -1296,7 +1297,7 @@
</span><span class="cx">     // FIXME: this should be removed. The layer should be marked composited by
</span><span class="cx">     // preparing for display, so that canvas image buffer and the layer agree
</span><span class="cx">     // on the content.
</span><del>-    virtual void markLayerComposited() = 0;
</del><ins>+    WEBCORE_EXPORT void markLayerComposited();
</ins><span class="cx"> 
</span><span class="cx">     enum class SimulatedEventForTesting {
</span><span class="cx">         ContextChange,
</span><span class="lines">@@ -1358,6 +1359,11 @@
</span><span class="cx">     int m_currentWidth { 0 };
</span><span class="cx">     int m_currentHeight { 0 };
</span><span class="cx">     HashSet<Client*> m_clients;
</span><ins>+    // A bitmask of GL buffer bits (GL_COLOR_BUFFER_BIT,
+    // GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT) which need to be
+    // auto-cleared.
+    GCGLbitfield m_buffersToAutoClear { 0 };
+    bool m_layerComposited { false };
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     GraphicsContextGLAttributes m_attrs;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsRemoteGraphicsContextGLProxyBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp      2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp 2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -68,42 +68,12 @@
</span><span class="cx"> void RemoteGraphicsContextGLProxyBase::markContextChanged()
</span><span class="cx"> {
</span><span class="cx">     // FIXME: The caller should track this state.
</span><del>-    if (m_layerComposited)
</del><ins>+    if (m_layerComposited) {
</ins><span class="cx">         notifyMarkContextChanged();
</span><del>-    m_layerComposited = false;
-}
-
-void RemoteGraphicsContextGLProxyBase::markLayerComposited()
-{
-    m_layerComposited = true;
-    auto attrs = contextAttributes();
-    if (!attrs.preserveDrawingBuffer) {
-        m_buffersToAutoClear = GraphicsContextGL::COLOR_BUFFER_BIT;
-        if (attrs.depth)
-            m_buffersToAutoClear |= GraphicsContextGL::DEPTH_BUFFER_BIT;
-        if (attrs.stencil)
-            m_buffersToAutoClear |= GraphicsContextGL::STENCIL_BUFFER_BIT;
</del><ins>+        GraphicsContextGL::markContextChanged();
</ins><span class="cx">     }
</span><del>-    for (auto* client : copyToVector(m_clients))
-        client->didComposite();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RemoteGraphicsContextGLProxyBase::layerComposited() const
-{
-    return m_layerComposited;
-}
-
-void RemoteGraphicsContextGLProxyBase::setBuffersToAutoClear(GCGLbitfield buffers)
-{
-    if (!contextAttributes().preserveDrawingBuffer)
-        m_buffersToAutoClear = buffers;
-}
-
-GCGLbitfield RemoteGraphicsContextGLProxyBase::getBuffersToAutoClear() const
-{
-    return m_buffersToAutoClear;
-}
-
</del><span class="cx"> bool RemoteGraphicsContextGLProxyBase::supports(const String& name)
</span><span class="cx"> {
</span><span class="cx">     waitUntilInitialized();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsRemoteGraphicsContextGLProxyBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h        2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h   2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -50,10 +50,6 @@
</span><span class="cx">     void setContextVisibility(bool) final;
</span><span class="cx">     bool isGLES2Compliant() const final;
</span><span class="cx">     void markContextChanged() final;
</span><del>-    bool layerComposited() const final;
-    void setBuffersToAutoClear(GCGLbitfield) final;
-    GCGLbitfield getBuffersToAutoClear() const final;
-    void markLayerComposited() final;
</del><span class="cx"> 
</span><span class="cx">     // Other ExtensionGL overrides.
</span><span class="cx">     using ExtensionsGL::isEnabled;
</span><span class="lines">@@ -79,10 +75,6 @@
</span><span class="cx">     HashSet<String> m_requestableExtensions;
</span><span class="cx"> 
</span><span class="cx">     HashSet<String> m_enabledExtensions;
</span><del>-
-    // FIXME: Drawing buffer clear tracking should be moved to the client.
-    bool m_layerComposited = false;
-    GCGLbitfield m_buffersToAutoClear = { 0 };
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsangleGraphicsContextGLANGLEcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp  2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp     2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -2153,25 +2153,6 @@
</span><span class="cx">     m_syntheticErrors.add(error);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContextGLOpenGL::markContextChanged()
-{
-    m_layerComposited = false;
-}
-
-void GraphicsContextGLOpenGL::markLayerComposited()
-{
-    m_layerComposited = true;
-    resetBuffersToAutoClear();
-
-    for (auto* client : copyToVector(m_clients))
-        client->didComposite();
-}
-
-bool GraphicsContextGLOpenGL::layerComposited() const
-{
-    return m_layerComposited;
-}
-
</del><span class="cx"> void GraphicsContextGLOpenGL::forceContextLost()
</span><span class="cx"> {
</span><span class="cx">     for (auto* client : copyToVector(m_clients))
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaGraphicsContextGLCocoah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h    2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h       2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -49,6 +49,11 @@
</span><span class="cx">     void detachIOSurfaceFromSharedTexture(void* handle);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    // GraphicsContextGLOpenGL overrides.
+#if ENABLE(VIDEO)
+    bool copyTextureFromMedia(MediaPlayer&, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) final;
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx">     GraphicsContextGLCocoa(WebCore::GraphicsContextGLAttributes&&);
</span><span class="cx">     bool isValid() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaGraphicsContextGLCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm   2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm      2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -47,8 +47,9 @@
</span><span class="cx"> #import "WebCoreThread.h"
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
</del><ins>+#if ENABLE(VIDEO)
</ins><span class="cx"> #include "GraphicsContextGLCVANGLE.h"
</span><ins>+#include "MediaPlayerPrivate.h"
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="lines">@@ -762,7 +763,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
</del><ins>+#if ENABLE(VIDEO)
</ins><span class="cx"> GraphicsContextGLCV* GraphicsContextGLOpenGL::asCV()
</span><span class="cx"> {
</span><span class="cx">     if (!m_cv)
</span><span class="lines">@@ -823,6 +824,23 @@
</span><span class="cx">     currentContext = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(VIDEO)
+bool GraphicsContextGLCocoa::copyTextureFromMedia(MediaPlayer& player, PlatformGLObject outputTexture, GCGLenum outputTarget, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY)
+{
+    auto pixelBuffer = player.pixelBufferForCurrentTime();
+    if (!pixelBuffer)
+        return false;
+
+    auto contextCV = asCV();
+    if (!contextCV)
+        return false;
+
+    UNUSED_VARIABLE(premultiplyAlpha);
+    ASSERT_UNUSED(outputTarget, outputTarget == GraphicsContextGL::TEXTURE_2D);
+    return contextCV->copyPixelBufferToTexture(pixelBuffer.get(), outputTexture, level, internalFormat, format, type, GraphicsContextGL::FlipY(flipY));
</ins><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp        2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp   2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -32,107 +32,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include "ExtensionsGL.h"
</span><span class="cx"> #include "ImageBuffer.h"
</span><del>-#include "MediaPlayerPrivate.h"
</del><span class="cx"> #include "PixelBuffer.h"
</span><span class="cx"> #include <memory>
</span><span class="cx"> #include <wtf/UniqueArray.h>
</span><span class="cx"> 
</span><del>-#if USE(AVFOUNDATION)
-#include "GraphicsContextGLCV.h"
-#endif
-
-#if !PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
-#include "MediaSample.h"
-#endif
-
-#if USE(GSTREAMER) && ENABLE(MEDIA_STREAM)
-#include "MediaSampleGStreamer.h"
-#endif
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void GraphicsContextGLOpenGL::resetBuffersToAutoClear()
-{
-    GCGLuint buffers = GraphicsContextGL::COLOR_BUFFER_BIT;
-    // The GraphicsContextGL's attributes (as opposed to
-    // WebGLRenderingContext's) indicate whether there is an
-    // implicitly-allocated stencil buffer, for example.
-    auto attrs = contextAttributes();
-    if (attrs.depth)
-        buffers |= GraphicsContextGL::DEPTH_BUFFER_BIT;
-    if (attrs.stencil)
-        buffers |= GraphicsContextGL::STENCIL_BUFFER_BIT;
-    setBuffersToAutoClear(buffers);
-}
-
-void GraphicsContextGLOpenGL::setBuffersToAutoClear(GCGLbitfield buffers)
-{
-    auto attrs = contextAttributes();
-    if (!attrs.preserveDrawingBuffer)
-        m_buffersToAutoClear = buffers;
-    else
-        ASSERT(!m_buffersToAutoClear);
-}
-
-GCGLbitfield GraphicsContextGLOpenGL::getBuffersToAutoClear() const
-{
-    return m_buffersToAutoClear;
-}
-
-#if !USE(ANGLE)
-bool GraphicsContextGLOpenGL::releaseThreadResources(ReleaseThreadResourceBehavior)
-{
-    return false;
-}
-
-void GraphicsContextGLOpenGL::platformReleaseThreadResources()
-{
-}
-#endif
-
-#if !USE(ANGLE)
-bool GraphicsContextGLOpenGL::texImage2DResourceSafe(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, GCGLint unpackAlignment)
-{
-    ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
-    UniqueArray<unsigned char> zero;
-    unsigned size = 0;
-    if (width > 0 && height > 0) {
-        PixelStoreParams params;
-        params.alignment = unpackAlignment;
-        GCGLenum error = computeImageSizeInBytes(format, type, width, height, 1, params, &size, nullptr, nullptr);
-        if (error != GraphicsContextGL::NO_ERROR) {
-            synthesizeGLError(error);
-            return false;
-        }
-        zero = makeUniqueArray<unsigned char>(size);
-        if (!zero) {
-            synthesizeGLError(GraphicsContextGL::INVALID_VALUE);
-            return false;
-        }
-        memset(zero.get(), 0, size);
-    }
-    texImage2D(target, level, internalformat, width, height, border, format, type, makeGCGLSpan(zero.get(), size));
-    return true;
-}
-#endif
-
-
-#if !PLATFORM(COCOA)
-void GraphicsContextGLOpenGL::setContextVisibility(bool)
-{
-}
-
-void GraphicsContextGLOpenGL::simulateEventForTesting(SimulatedEventForTesting event)
-{
-    if (event == SimulatedEventForTesting::GPUStatusFailure)
-        m_failNextStatusCheck = true;
-}
-
-void GraphicsContextGLOpenGL::prepareForDisplay()
-{
-}
-#endif
-
</del><span class="cx"> void GraphicsContextGLOpenGL::paintRenderingResultsToCanvas(ImageBuffer& imageBuffer)
</span><span class="cx"> {
</span><span class="cx">     if (!makeContextCurrent())
</span><span class="lines">@@ -180,17 +85,6 @@
</span><span class="cx">     return results;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
-RefPtr<MediaSample> GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample()
-{
-#if USE(GSTREAMER)
-    if (auto pixelBuffer = readCompositedResults())
-        return MediaSampleGStreamer::createImageSample(WTFMove(*pixelBuffer));
-#endif
-    return nullptr;
-}
-#endif
-
</del><span class="cx"> std::optional<PixelBuffer> GraphicsContextGLOpenGL::readRenderingResultsForPainting()
</span><span class="cx"> {
</span><span class="cx">     if (!makeContextCurrent())
</span><span class="lines">@@ -209,34 +103,6 @@
</span><span class="cx">     return readCompositedResults();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(COCOA)
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readCompositedResults()
-{
-    return readRenderingResults();
-}
-#endif
-
-#if ENABLE(VIDEO)
-bool GraphicsContextGLOpenGL::copyTextureFromMedia(MediaPlayer& player, PlatformGLObject outputTexture, GCGLenum outputTarget, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY)
-{
-#if USE(AVFOUNDATION)
-    auto pixelBuffer = player.pixelBufferForCurrentTime();
-    if (!pixelBuffer)
-        return false;
-
-    auto contextCV = asCV();
-    if (!contextCV)
-        return false;
-
-    UNUSED_VARIABLE(premultiplyAlpha);
-    ASSERT_UNUSED(outputTarget, outputTarget == GraphicsContextGL::TEXTURE_2D);
-    return contextCV->copyPixelBufferToTexture(pixelBuffer.get(), outputTexture, level, internalFormat, format, type, GraphicsContextGL::FlipY(flipY));
-#else
-    return player.copyVideoTextureToPlatformTexture(this, outputTexture, outputTarget, level, internalFormat, format, type, premultiplyAlpha, flipY);
-#endif
-}
-#endif
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h  2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h     2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -113,7 +113,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> #if USE(ANGLE)
</span><span class="cx">     GCGLenum drawingBufferTextureTarget();
</span><del>-#endif
</del><span class="cx">     enum class ReleaseThreadResourceBehavior {
</span><span class="cx">         // Releases current context after GraphicsContextGLOpenGL calls done in the thread.
</span><span class="cx">         ReleaseCurrentContext,
</span><span class="lines">@@ -124,6 +123,7 @@
</span><span class="cx">         TerminateAndReleaseThreadResources
</span><span class="cx">     };
</span><span class="cx">     static bool releaseThreadResources(ReleaseThreadResourceBehavior);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     // With multisampling on, blit from multisampleFBO to regular FBO.
</span><span class="cx">     void prepareTexture();
</span><span class="lines">@@ -442,19 +442,9 @@
</span><span class="cx">     void multiDrawElementsInstancedANGLE(GCGLenum mode, GCGLSpan<const GCGLsizei> counts, GCGLenum type, GCGLSpan<const GCGLint> offsets, GCGLSpan<const GCGLsizei> instanceCounts, GCGLsizei drawcount) override;
</span><span class="cx"> 
</span><span class="cx">     // Helper methods.
</span><del>-    void markContextChanged() final;
-    void markLayerComposited() final;
-    bool layerComposited() const final;
</del><span class="cx">     void forceContextLost();
</span><span class="cx">     void recycleContext();
</span><span class="cx"> 
</span><del>-    // Maintenance of auto-clearing of color/depth/stencil buffers. The
-    // reset method is present to keep calling code simpler, so it
-    // doesn't have to know which buffers were allocated.
-    void resetBuffersToAutoClear();
-    void setBuffersToAutoClear(GCGLbitfield) final;
-    GCGLbitfield getBuffersToAutoClear() const final;
-
</del><span class="cx">     void dispatchContextChangedNotification();
</span><span class="cx"> 
</span><span class="cx">     void paintRenderingResultsToCanvas(ImageBuffer&) final;
</span><span class="lines">@@ -467,10 +457,6 @@
</span><span class="cx">     std::optional<PixelBuffer> readRenderingResultsForPainting();
</span><span class="cx">     std::optional<PixelBuffer> readCompositedResultsForPainting();
</span><span class="cx"> 
</span><del>-#if ENABLE(VIDEO)
-    bool copyTextureFromMedia(MediaPlayer&, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) final;
-#endif
-
</del><span class="cx"> #if USE(OPENGL) && ENABLE(WEBGL2)
</span><span class="cx">     void primitiveRestartIndex(GCGLuint);
</span><span class="cx"> #endif
</span><span class="lines">@@ -576,9 +562,10 @@
</span><span class="cx"> #if USE(ANGLE)
</span><span class="cx">     // Returns false if context should be lost due to timeout.
</span><span class="cx">     bool waitAndUpdateOldestFrame() WARN_UNUSED_RETURN;
</span><del>-#endif
</del><ins>+
</ins><span class="cx">     // Platform specific behavior for releaseResources();
</span><span class="cx">     static void platformReleaseThreadResources();
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if !USE(ANGLE)
</span><span class="cx">     typedef HashMap<String, UniqueRef<sh::ShaderVariable>> ShaderSymbolMap;
</span><span class="lines">@@ -680,7 +667,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     GCGLuint m_depthStencilBuffer { 0 };
</span><span class="cx"> 
</span><del>-    bool m_layerComposited { false };
</del><span class="cx">     GCGLuint m_internalColorFormat { 0 };
</span><span class="cx"> #if USE(ANGLE)
</span><span class="cx">     GCGLuint m_internalDepthStencilFormat { 0 };
</span><span class="lines">@@ -741,11 +727,6 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    // A bitmask of GL buffer bits (GL_COLOR_BUFFER_BIT,
-    // GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT) which need to be
-    // auto-cleared.
-    GCGLbitfield m_buffersToAutoClear { 0 };
-
</del><span class="cx">     // Errors raised by synthesizeGLError().
</span><span class="cx">     ListHashSet<GCGLenum> m_syntheticErrors;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp  2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp     2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -2106,25 +2106,6 @@
</span><span class="cx">     m_syntheticErrors.add(error);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContextGLOpenGL::markContextChanged()
-{
-    m_layerComposited = false;
-}
-
-void GraphicsContextGLOpenGL::markLayerComposited()
-{
-    m_layerComposited = true;
-    resetBuffersToAutoClear();
-
-    for (auto* client : copyToVector(m_clients))
-        client->didComposite();
-}
-
-bool GraphicsContextGLOpenGL::layerComposited() const
-{
-    return m_layerComposited;
-}
-
</del><span class="cx"> void GraphicsContextGLOpenGL::forceContextLost()
</span><span class="cx"> {
</span><span class="cx">     for (auto* client : copyToVector(m_clients))
</span><span class="lines">@@ -2874,6 +2855,30 @@
</span><span class="cx">     synthesizeGLError(GraphicsContextGL::INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool GraphicsContextGLOpenGL::texImage2DResourceSafe(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, GCGLint unpackAlignment)
+{
+    ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
+    UniqueArray<unsigned char> zero;
+    unsigned size = 0;
+    if (width > 0 && height > 0) {
+        PixelStoreParams params;
+        params.alignment = unpackAlignment;
+        GCGLenum error = computeImageSizeInBytes(format, type, width, height, 1, params, &size, nullptr, nullptr);
+        if (error != GraphicsContextGL::NO_ERROR) {
+            synthesizeGLError(error);
+            return false;
+        }
+        zero = makeUniqueArray<unsigned char>(size);
+        if (!zero) {
+            synthesizeGLError(GraphicsContextGL::INVALID_VALUE);
+            return false;
+        }
+        memset(zero.get(), 0, size);
+    }
+    texImage2D(target, level, internalformat, width, height, border, format, type, makeGCGLSpan(zero.get(), size));
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(WEBGL) && !USE(ANGLE)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapGraphicsContextGLTextureMappercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp 2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp    2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include "GLContext.h"
</span><span class="cx"> #include "GraphicsContextGLOpenGLManager.h"
</span><ins>+#include "PixelBuffer.h"
</ins><span class="cx"> #include "TextureMapperGCGLPlatformLayer.h"
</span><span class="cx"> #include <wtf/Deque.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="lines">@@ -64,6 +65,18 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_STREAM)
+#include "MediaSample.h"
+#endif
+
+#if USE(GSTREAMER) && ENABLE(MEDIA_STREAM)
+#include "MediaSampleGStreamer.h"
+#endif
+
+#if ENABLE(VIDEO)
+#include "MediaPlayerPrivate.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> RefPtr<GraphicsContextGLTextureMapper> GraphicsContextGLTextureMapper::create(GraphicsContextGLAttributes&& attributes)
</span><span class="lines">@@ -455,6 +468,43 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void GraphicsContextGLOpenGL::setContextVisibility(bool)
+{
+}
+
+void GraphicsContextGLOpenGL::simulateEventForTesting(SimulatedEventForTesting event)
+{
+    if (event == SimulatedEventForTesting::GPUStatusFailure)
+        m_failNextStatusCheck = true;
+}
+
+void GraphicsContextGLOpenGL::prepareForDisplay()
+{
+}
+
+#if ENABLE(MEDIA_STREAM)
+RefPtr<MediaSample> GraphicsContextGLOpenGL::paintCompositedResultsToMediaSample()
+{
+#if USE(GSTREAMER)
+    if (auto pixelBuffer = readCompositedResults())
+        return MediaSampleGStreamer::createImageSample(WTFMove(*pixelBuffer));
+#endif
+    return nullptr;
+}
+#endif
+
+std::optional<PixelBuffer> GraphicsContextGLOpenGL::readCompositedResults()
+{
+    return readRenderingResults();
+}
+
+#if ENABLE(VIDEO)
+bool GraphicsContextGLTextureMapper::copyTextureFromMedia(MediaPlayer& player, PlatformGLObject outputTexture, GCGLenum outputTarget, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY)
+{
+    return player.copyVideoTextureToPlatformTexture(this, outputTexture, outputTarget, level, internalFormat, format, type, premultiplyAlpha, flipY);
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBGL) && USE(TEXTURE_MAPPER)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapGraphicsContextGLTextureMapperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.h (286174 => 286175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.h   2021-11-26 09:22:15 UTC (rev 286174)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.h      2021-11-26 11:11:33 UTC (rev 286175)
</span><span class="lines">@@ -36,6 +36,9 @@
</span><span class="cx">     static RefPtr<GraphicsContextGLTextureMapper> create(WebCore::GraphicsContextGLAttributes&&);
</span><span class="cx">     ~GraphicsContextGLTextureMapper();
</span><span class="cx"> 
</span><ins>+#if ENABLE(VIDEO)
+    bool copyTextureFromMedia(MediaPlayer&, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) final;
+#endif
</ins><span class="cx"> protected:
</span><span class="cx">     GraphicsContextGLTextureMapper(WebCore::GraphicsContextGLAttributes&&);
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>