Title: [213783] trunk/Source/WebCore
Revision
213783
Author
[email protected]
Date
2017-03-13 00:18:33 -0700 (Mon, 13 Mar 2017)

Log Message

WebGPU: Backend - hosting WebGPU layers
https://bugs.webkit.org/show_bug.cgi?id=169366
<rdar://problem/30928735>

Reviewed by Dean Jackson.

* html/canvas/WebGPURenderingContext.cpp:
(WebCore::WebGPURenderingContext::create): Create the device and the
rendering context.
* platform/graphics/cocoa/GPUCommandBufferMetal.mm:
(WebCore::GPUCommandBuffer::commit):
* platform/graphics/cocoa/GPUDrawableMetal.mm:
(WebCore::GPUDrawable::release): Fix a log message
* platform/graphics/gpu/GPUCommandBuffer.cpp:
(WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
* rendering/RenderLayerBacking.cpp:
(WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213782 => 213783)


--- trunk/Source/WebCore/ChangeLog	2017-03-13 06:17:56 UTC (rev 213782)
+++ trunk/Source/WebCore/ChangeLog	2017-03-13 07:18:33 UTC (rev 213783)
@@ -1,3 +1,23 @@
+2017-03-13  Jon Lee  <[email protected]>
+
+        WebGPU: Backend - hosting WebGPU layers
+        https://bugs.webkit.org/show_bug.cgi?id=169366
+        <rdar://problem/30928735>
+
+        Reviewed by Dean Jackson.
+
+        * html/canvas/WebGPURenderingContext.cpp:
+        (WebCore::WebGPURenderingContext::create): Create the device and the
+        rendering context.
+        * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
+        (WebCore::GPUCommandBuffer::commit):
+        * platform/graphics/cocoa/GPUDrawableMetal.mm:
+        (WebCore::GPUDrawable::release): Fix a log message
+        * platform/graphics/gpu/GPUCommandBuffer.cpp:
+        (WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.
+
 2017-03-12  Jon Lee  <[email protected]>
 
         Remove stubs from WebGPU front end

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp (213782 => 213783)


--- trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2017-03-13 06:17:56 UTC (rev 213782)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2017-03-13 07:18:33 UTC (rev 213783)
@@ -71,24 +71,8 @@
 
 std::unique_ptr<WebGPURenderingContext> WebGPURenderingContext::create(HTMLCanvasElement& canvas)
 {
-    UNUSED_PARAM(canvas);
-/* FIXME: WebGPU - To be implemented.
-    Document& document = canvas.document();
-    Frame* frame = document.frame();
-    if (!frame)
-        return nullptr;
+    RefPtr<GPUDevice> device(GPUDevice::create());
 
-    GPUDevice::Attributes attributes;
-
-    attributes.antialias = false;
-
-    // FIXME: WebGPU - handle retina.
-    // if (page)
-    //     attributes.devicePixelRatio = page->deviceScaleFactor();
-
-    HostWindow* hostWindow = document.view()->root()->hostWindow();
-    RefPtr<GPUDevice> device(GPUDevice::create(attributes, hostWindow));
-
     if (!device) {
         // FIXME: WebGPU - dispatch an event here for the failure.
         return nullptr;
@@ -99,8 +83,6 @@
     renderingContext->suspendIfNeeded();
 
     return renderingContext;
-*/
-    return nullptr;
 }
 
 WebGPURenderingContext::WebGPURenderingContext(HTMLCanvasElement& canvas, PassRefPtr<GPUDevice> device)

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GPUCommandBufferMetal.mm (213782 => 213783)


--- trunk/Source/WebCore/platform/graphics/cocoa/GPUCommandBufferMetal.mm	2017-03-13 06:17:56 UTC (rev 213782)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GPUCommandBufferMetal.mm	2017-03-13 07:18:33 UTC (rev 213783)
@@ -61,6 +61,14 @@
     drawable->release();
 }
 
+void GPUCommandBuffer::commit()
+{
+    if (!m_commandBuffer)
+        return;
+
+    [m_commandBuffer commit];
+}
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GPUDrawableMetal.mm (213782 => 213783)


--- trunk/Source/WebCore/platform/graphics/cocoa/GPUDrawableMetal.mm	2017-03-13 06:17:56 UTC (rev 213782)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GPUDrawableMetal.mm	2017-03-13 07:18:33 UTC (rev 213783)
@@ -48,7 +48,7 @@
 
 void GPUDrawable::release()
 {
-    LOG(WebGPU, "MetalDrawable::release()");
+    LOG(WebGPU, "GPUDrawable::release()");
     m_drawable = nullptr;
 }
     

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.cpp (213782 => 213783)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.cpp	2017-03-13 06:17:56 UTC (rev 213782)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.cpp	2017-03-13 07:18:33 UTC (rev 213783)
@@ -47,10 +47,6 @@
     LOG(WebGPU, "GPUCommandBuffer::~GPUCommandBuffer()");
 }
 
-void GPUCommandBuffer::commit()
-{
-}
-
 RefPtr<GPURenderCommandEncoder> GPUCommandBuffer::createRenderCommandEncoder(GPURenderPassDescriptor* descriptor)
 {
     return GPURenderCommandEncoder::create(this, descriptor);

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (213782 => 213783)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-03-13 06:17:56 UTC (rev 213782)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2017-03-13 07:18:33 UTC (rev 213783)
@@ -84,6 +84,11 @@
     if (context->is3d())
         return CanvasAsLayerContents;
 
+#if ENABLE(WEBGPU)
+    if (context->isGPU())
+        return CanvasAsLayerContents;
+#endif
+
 #if ENABLE(ACCELERATED_2D_CANVAS)
     return CanvasAsLayerContents;
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to