Title: [213977] trunk/Source/WebCore
Revision
213977
Author
d...@apple.com
Date
2017-03-15 02:43:12 -0700 (Wed, 15 Mar 2017)

Log Message

Make a base class for WebGL and WebGPU contexts
https://bugs.webkit.org/show_bug.cgi?id=169651
<rdar://problem/31053489>

Reviewed by Simon Fraser.

Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
will be used by WebGL and WebGPU rendering contexts. This allows us
to avoid some code duplication, since many places treat the two
as the same.

Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().

* WebCore.xcodeproj/project.pbxproj: New file.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContextWebGL):
(WebCore::HTMLCanvasElement::getContextWebGPU):
(WebCore::HTMLCanvasElement::reset):
(WebCore::HTMLCanvasElement::paint):
(WebCore::HTMLCanvasElement::isGPUBased):
(WebCore::HTMLCanvasElement::getImageData):
(WebCore::HTMLCanvasElement::isGPU): Deleted.
(WebCore::HTMLCanvasElement::is3D): Deleted.
* html/HTMLCanvasElement.h:
* html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::isWebGL):
(WebCore::CanvasRenderingContext::isWebGPU):
(WebCore::CanvasRenderingContext::isGPUBased):
(WebCore::CanvasRenderingContext::is3d): Deleted.
(WebCore::CanvasRenderingContext::isGPU): Deleted.
* html/canvas/GPUBasedCanvasRenderingContext.h: Added.
(WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGPURenderingContext.cpp:
(WebCore::WebGPURenderingContext::WebGPURenderingContext):
* html/canvas/WebGPURenderingContext.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::canvasCompositingStrategy):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213976 => 213977)


--- trunk/Source/WebCore/ChangeLog	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/ChangeLog	2017-03-15 09:43:12 UTC (rev 213977)
@@ -1,3 +1,46 @@
+2017-03-14  Dean Jackson  <d...@apple.com>
+
+        Make a base class for WebGL and WebGPU contexts
+        https://bugs.webkit.org/show_bug.cgi?id=169651
+        <rdar://problem/31053489>
+
+        Reviewed by Simon Fraser.
+
+        Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
+        will be used by WebGL and WebGPU rendering contexts. This allows us
+        to avoid some code duplication, since many places treat the two
+        as the same.
+
+        Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
+
+        * WebCore.xcodeproj/project.pbxproj: New file.
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContextWebGL):
+        (WebCore::HTMLCanvasElement::getContextWebGPU):
+        (WebCore::HTMLCanvasElement::reset):
+        (WebCore::HTMLCanvasElement::paint):
+        (WebCore::HTMLCanvasElement::isGPUBased):
+        (WebCore::HTMLCanvasElement::getImageData):
+        (WebCore::HTMLCanvasElement::isGPU): Deleted.
+        (WebCore::HTMLCanvasElement::is3D): Deleted.
+        * html/HTMLCanvasElement.h:
+        * html/canvas/CanvasRenderingContext.h:
+        (WebCore::CanvasRenderingContext::isWebGL):
+        (WebCore::CanvasRenderingContext::isWebGPU):
+        (WebCore::CanvasRenderingContext::isGPUBased):
+        (WebCore::CanvasRenderingContext::is3d): Deleted.
+        (WebCore::CanvasRenderingContext::isGPU): Deleted.
+        * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
+        (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * html/canvas/WebGPURenderingContext.cpp:
+        (WebCore::WebGPURenderingContext::WebGPURenderingContext):
+        * html/canvas/WebGPURenderingContext.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::canvasCompositingStrategy):
+
 2017-03-15  Zan Dobersek  <zdober...@igalia.com>
 
         Unreviewed GTK+ build fix. Sprinkle ENABLE(MEDIA_STREAM) build guards

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213976 => 213977)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-15 09:43:12 UTC (rev 213977)
@@ -1335,6 +1335,7 @@
 		31078CCA1880AACE008099DC /* JSOESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC61880AAAA008099DC /* JSOESTextureHalfFloatLinear.h */; };
 		310D71951B335C9D009C7B73 /* ThemeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 310D71931B335C9D009C7B73 /* ThemeCocoa.mm */; };
 		310D71961B335C9E009C7B73 /* ThemeCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 310D71941B335C9D009C7B73 /* ThemeCocoa.h */; };
+		311518FC1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 311518FB1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h */; };
 		311C08BD18EB7CAF00B65615 /* mediaControlsApple.css in Resources */ = {isa = PBXBuildFile; fileRef = CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */; };
 		311C08BE18EB7CAF00B65615 /* mediaControlsApple.js in Resources */ = {isa = PBXBuildFile; fileRef = CDE6560E17CA6E7600526BA7 /* mediaControlsApple.js */; };
 		311C08BF18EB7CAF00B65615 /* mediaControlsiOS.css in Resources */ = {isa = PBXBuildFile; fileRef = CDAAF45D1869094E003C1717 /* mediaControlsiOS.css */; };
@@ -8814,6 +8815,7 @@
 		31078CC61880AAAA008099DC /* JSOESTextureHalfFloatLinear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESTextureHalfFloatLinear.h; sourceTree = "<group>"; };
 		310D71931B335C9D009C7B73 /* ThemeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ThemeCocoa.mm; sourceTree = "<group>"; };
 		310D71941B335C9D009C7B73 /* ThemeCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeCocoa.h; sourceTree = "<group>"; };
+		311518FB1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUBasedCanvasRenderingContext.h; sourceTree = "<group>"; };
 		311C08BC18E35D6800B65615 /* ControlStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlStates.h; sourceTree = "<group>"; };
 		31288E6E0E3005D6003619AE /* CSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSKeyframeRule.cpp; sourceTree = "<group>"; };
 		31288E6F0E3005D6003619AE /* CSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSKeyframeRule.h; sourceTree = "<group>"; };
@@ -17856,6 +17858,7 @@
 				31A089011E737B4D003B6609 /* WebGPUTextureDescriptor.cpp */,
 				31A089021E737B4D003B6609 /* WebGPUTextureDescriptor.h */,
 				31A089031E737B4D003B6609 /* WebGPUTextureDescriptor.idl */,
+				311518FB1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h */,
 			);
 			path = canvas;
 			sourceTree = "<group>";
@@ -28529,6 +28532,7 @@
 				4A4F65741AA997F100E38CDD /* RealtimeMediaSourceSettings.h in Headers */,
 				07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */,
 				41103AAC1E39791000769F03 /* RealtimeOutgoingAudioSource.h in Headers */,
+				311518FC1E78C15F00EC514A /* GPUBasedCanvasRenderingContext.h in Headers */,
 				BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
 				FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */,
 				9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (213976 => 213977)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2017-03-15 09:43:12 UTC (rev 213977)
@@ -293,7 +293,7 @@
     if (!shouldEnableWebGL(document().settings()))
         return nullptr;
 
-    if (m_context && !m_context->is3d())
+    if (m_context && !m_context->isWebGL())
         return nullptr;
 
     if (!m_context) {
@@ -321,7 +321,7 @@
     if (!RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled())
         return nullptr;
 
-    if (m_context && !m_context->isGPU())
+    if (m_context && !m_context->isWebGPU())
         return nullptr;
 
     if (!m_context) {
@@ -393,17 +393,9 @@
 
     setSurfaceSize(newSize);
 
-#if ENABLE(WEBGPU)
-    // FIXME: WebGPU needs something here too.
-    if (isGPU() && oldSize != size())
-        static_cast<WebGPURenderingContext*>(m_context.get())->reshape(width(), height());
-#endif
+    if (isGPUBased() && oldSize != size())
+        downcast<GPUBasedCanvasRenderingContext>(*m_context.get()).reshape(width(), height());
 
-#if ENABLE(WEBGL)
-    if (is3D() && oldSize != size())
-        static_cast<WebGLRenderingContextBase*>(m_context.get())->reshape(width(), height());
-#endif
-
     auto renderer = this->renderer();
     if (is<RenderHTMLCanvas>(renderer)) {
         auto& canvasRenderer = downcast<RenderHTMLCanvas>(*renderer);
@@ -467,31 +459,15 @@
         }
     }
 
-#if ENABLE(WEBGPU)
-    if (isGPU())
-        static_cast<WebGPURenderingContext*>(m_context.get())->markLayerComposited();
-#endif
-
-#if ENABLE(WEBGL)
-    if (is3D())
-        static_cast<WebGLRenderingContextBase*>(m_context.get())->markLayerComposited();
-#endif
+    if (isGPUBased())
+        downcast<GPUBasedCanvasRenderingContext>(*m_context.get()).markLayerComposited();
 }
 
-#if ENABLE(WEBGPU)
-bool HTMLCanvasElement::isGPU() const
+bool HTMLCanvasElement::isGPUBased() const
 {
-    return m_context && m_context->isGPU();
+    return m_context && m_context->isGPUBased();
 }
-#endif
 
-#if ENABLE(WEBGL)
-bool HTMLCanvasElement::is3D() const
-{
-    return m_context && m_context->is3d();
-}
-#endif
-
 void HTMLCanvasElement::makeRenderingResultsAvailable()
 {
     if (m_context)
@@ -592,7 +568,7 @@
 RefPtr<ImageData> HTMLCanvasElement::getImageData()
 {
 #if ENABLE(WEBGL)
-    if (!is3D())
+    if (!m_context || !m_context->isWebGL())
         return nullptr;
 
     WebGLRenderingContextBase* ctx = static_cast<WebGLRenderingContextBase*>(m_context.get());

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (213976 => 213977)


--- trunk/Source/WebCore/html/HTMLCanvasElement.h	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h	2017-03-15 09:43:12 UTC (rev 213977)
@@ -177,12 +177,7 @@
 
     bool paintsIntoCanvasBuffer() const;
 
-#if ENABLE(WEBGL)
-    bool is3D() const;
-#endif
-#if ENABLE(WEBGPU)
-    bool isGPU() const;
-#endif
+    bool isGPUBased() const;
 
     HashSet<CanvasObserver*> m_observers;
     std::unique_ptr<CanvasRenderingContext> m_context;

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h (213976 => 213977)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h	2017-03-15 09:43:12 UTC (rev 213977)
@@ -53,8 +53,11 @@
     virtual bool is2d() const { return false; }
     virtual bool isWebGL1() const { return false; }
     virtual bool isWebGL2() const { return false; }
-    bool is3d() const { return isWebGL1() || isWebGL2(); }
-    virtual bool isGPU() const { return false; }
+    bool isWebGL() const { return isWebGL1() || isWebGL2(); }
+#if ENABLE(WEBGPU)
+    virtual bool isWebGPU() const { return false; }
+#endif
+    virtual bool isGPUBased() const { return false; }
     virtual bool isAccelerated() const { return false; }
 
     virtual void paintRenderingResultsToCanvas() {}

Added: trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h (0 => 213977)


--- trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h	2017-03-15 09:43:12 UTC (rev 213977)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ActiveDOMObject.h"
+#include "CanvasRenderingContext.h"
+
+namespace WebCore {
+
+class GPUBasedCanvasRenderingContext : public CanvasRenderingContext, public ActiveDOMObject {
+public:
+
+    bool isGPUBased() const override { return true; }
+
+    bool isAccelerated() const override
+    {
+#if PLATFORM(WIN)
+        // FIXME: Implement accelerated canvas on Windows.
+        return false;
+#else
+        return true;
+#endif
+    }
+
+    virtual void reshape(int width, int height) = 0;
+    virtual void markLayerComposited() = 0;
+
+protected:
+    GPUBasedCanvasRenderingContext(HTMLCanvasElement& passedCanvas)
+        : CanvasRenderingContext(passedCanvas)
+        , ActiveDOMObject(&passedCanvas.document())
+    {
+    }
+};
+    
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::GPUBasedCanvasRenderingContext, isGPUBased())
Property changes on: trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (213976 => 213977)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-03-15 09:43:12 UTC (rev 213977)
@@ -460,8 +460,7 @@
 }
 
 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, WebGLContextAttributes attributes)
-    : CanvasRenderingContext(passedCanvas)
-    , ActiveDOMObject(&passedCanvas.document())
+    : GPUBasedCanvasRenderingContext(passedCanvas)
     , m_dispatchContextLostEventTimer(*this, &WebGLRenderingContextBase::dispatchContextLostEvent)
     , m_restoreTimer(*this, &WebGLRenderingContextBase::maybeRestoreContext)
     , m_attributes(attributes)
@@ -474,8 +473,7 @@
 }
 
 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement& passedCanvas, Ref<GraphicsContext3D>&& context, WebGLContextAttributes attributes)
-    : CanvasRenderingContext(passedCanvas)
-    , ActiveDOMObject(&passedCanvas.document())
+    : GPUBasedCanvasRenderingContext(passedCanvas)
     , m_context(WTFMove(context))
     , m_dispatchContextLostEventTimer(*this, &WebGLRenderingContextBase::dispatchContextLostEvent)
     , m_restoreTimer(*this, &WebGLRenderingContextBase::maybeRestoreContext)

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (213976 => 213977)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2017-03-15 09:43:12 UTC (rev 213977)
@@ -27,9 +27,8 @@
 
 #if ENABLE(WEBGL)
 
-#include "ActiveDOMObject.h"
 #include "ActivityStateChangeObserver.h"
-#include "CanvasRenderingContext.h"
+#include "GPUBasedCanvasRenderingContext.h"
 #include "GraphicsContext3D.h"
 #include "ImageBuffer.h"
 #include "Timer.h"
@@ -110,18 +109,11 @@
     return (*clippedX != x || *clippedY != y || *clippedWidth != width || *clippedHeight != height);
 }
 
-class WebGLRenderingContextBase : public CanvasRenderingContext, private ActivityStateChangeObserver, public ActiveDOMObject {
+class WebGLRenderingContextBase : public GPUBasedCanvasRenderingContext, private ActivityStateChangeObserver {
 public:
     static std::unique_ptr<WebGLRenderingContextBase> create(HTMLCanvasElement&, WebGLContextAttributes&, const String&);
     virtual ~WebGLRenderingContextBase();
 
-#if PLATFORM(WIN)
-    // FIXME: Implement accelerated 3d canvas on Windows.
-    bool isAccelerated() const override { return false; }
-#else
-    bool isAccelerated() const override { return true; }
-#endif
-
     int drawingBufferWidth() const;
     int drawingBufferHeight() const;
 
@@ -347,9 +339,9 @@
     WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
     PlatformLayer* platformLayer() const override;
 
-    void reshape(int width, int height);
+    void reshape(int width, int height) override;
 
-    void markLayerComposited();
+    void markLayerComposited() override final;
     void paintRenderingResultsToCanvas() override;
     RefPtr<ImageData> paintRenderingResultsToImageData();
 
@@ -846,6 +838,6 @@
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGLRenderingContextBase, is3d())
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGLRenderingContextBase, isWebGL())
 
 #endif

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp (213976 => 213977)


--- trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2017-03-15 09:43:12 UTC (rev 213977)
@@ -86,8 +86,7 @@
 }
 
 WebGPURenderingContext::WebGPURenderingContext(HTMLCanvasElement& canvas, PassRefPtr<GPUDevice> device)
-    : CanvasRenderingContext(canvas)
-    , ActiveDOMObject(&canvas.document())
+    : GPUBasedCanvasRenderingContext(canvas)
     , m_device(device)
 {
     initializeNewContext();

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderingContext.h (213976 => 213977)


--- trunk/Source/WebCore/html/canvas/WebGPURenderingContext.h	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderingContext.h	2017-03-15 09:43:12 UTC (rev 213977)
@@ -27,8 +27,7 @@
 
 #if ENABLE(WEBGPU)
 
-#include "ActiveDOMObject.h"
-#include "CanvasRenderingContext.h"
+#include "GPUBasedCanvasRenderingContext.h"
 #include "GPUDevice.h"
 #include <runtime/ArrayBuffer.h>
 
@@ -46,19 +45,16 @@
 class WebGPUTexture;
 class WebGPUTextureDescriptor;
 
-class WebGPURenderingContext : public CanvasRenderingContext, public ActiveDOMObject {
+class WebGPURenderingContext : public GPUBasedCanvasRenderingContext {
 public:
     static std::unique_ptr<WebGPURenderingContext> create(HTMLCanvasElement&);
-//    virtual ~WebGPURenderingContext();
 
-    bool isGPU() const override { return true; }
+    bool isWebGPU() const override final { return true; }
 
-    bool isAccelerated() const override { return true; }
+    void reshape(int width, int height) override final;
 
-    void reshape(int width, int height);
+    void markLayerComposited() override final;
 
-    void markLayerComposited();
-
     PlatformLayer* platformLayer() const override;
 
     RefPtr<GPUDevice> device() { return m_device; }
@@ -90,7 +86,6 @@
     void initializeNewContext();
 
 private:
-//    WebGPURenderingContext(HTMLCanvasElement*);//, GraphicsContext3D::Attributes);
     WebGPURenderingContext(HTMLCanvasElement&, PassRefPtr<GPUDevice>);
 
     RefPtr<GPUDevice> m_device;
@@ -98,6 +93,6 @@
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGPURenderingContext, isGPU())
+SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::WebGPURenderingContext, isWebGPU())
 
 #endif

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (213976 => 213977)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-03-15 08:35:07 UTC (rev 213976)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-03-15 09:43:12 UTC (rev 213977)
@@ -81,14 +81,9 @@
     if (!context || !context->isAccelerated())
         return UnacceleratedCanvas;
     
-    if (context->is3d())
+    if (context->isGPUBased())
         return CanvasAsLayerContents;
 
-#if ENABLE(WEBGPU)
-    if (context->isGPU())
-        return CanvasAsLayerContents;
-#endif
-
 #if ENABLE(ACCELERATED_2D_CANVAS)
     return CanvasAsLayerContents;
 #else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to