[WebGPU] WebGPUQueue::submit and WebGPURenderingContext::present() implementation
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Dec 2018 00:11:49 +0000 (00:11 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Dec 2018 00:11:49 +0000 (00:11 +0000)
commit59d1f5ce05a5e39a1392cdedc74d068e7dea60a0
tree29c45c4476d80cf800739bb4cbcf81832fe8a0f4
parente106097134299e6cbc676129ecc233f0531a2fc1
[WebGPU] WebGPUQueue::submit and WebGPURenderingContext::present() implementation
https://bugs.webkit.org/show_bug.cgi?id=192254

Reviewed by Dean Jackson.

Source/WebCore:

Final plumbing to render onto an HTMLCanvasElement with WebGPU. Also added ref-test that draws
a green square onto a canvas using WebGPU; reference uses 2D canvas.

Test: webgpu/simple-triangle-strip.html

* Modules/webgpu/WebGPUCommandBuffer.h:
* Modules/webgpu/WebGPUSwapChain.h: Needs to override platformLayer() for CanvasBasedRenderingContext.
* platform/graphics/gpu/GPUQueue.h:
* platform/graphics/gpu/GPUSwapChain.h:
(WebCore::GPUSwapChain::metalLayer const): Renamed from platformLayer.
(WebCore::GPUSwapChain::platformLayer const): Deleted.
* platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
(WebCore::GPUQueue::submit):
* platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
(WebCore::GPUSwapChain::getNextTexture): Returns the texture of the swap layer's next drawable.
(WebCore::GPUSwapChain::present): Presents the last-returned drawable from getNextTexture, and frees it.
(WebCore::GPUSwapChain::platformLayer const):

LayoutTests:

Update webgpu-basics to render an image into canvas. Also added ref-test that draws
a green square onto a canvas using WebGPU; reference uses 2D canvas.

* webgpu/js/basic-webgpu-functions.js:
(render):
* webgpu/simple-triangle-strip-expected.html: Added.
* webgpu/simple-triangle-strip.html: Added.
* webgpu/webgpu-basics.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/js/basic-webgpu-functions.js
LayoutTests/webgpu/simple-triangle-strip-expected.html [new file with mode: 0644]
LayoutTests/webgpu/simple-triangle-strip.html [new file with mode: 0644]
LayoutTests/webgpu/webgpu-basics.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h
Source/WebCore/Modules/webgpu/WebGPUSwapChain.h
Source/WebCore/platform/graphics/gpu/GPUQueue.h
Source/WebCore/platform/graphics/gpu/GPUSwapChain.h
Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm
Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm