Implement WebGPUQueue and device.getQueue()
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2018 21:17:41 +0000 (21:17 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2018 21:17:41 +0000 (21:17 +0000)
commitafdff08b3a7586232a0c5234a35f4bbdd8617558
treee9663b8f5632a83efb28e3ac8b776f103ec12092
parent7ebbe2223bad74918bcf8aaa9b4d49a47f5efaa1
Implement WebGPUQueue and device.getQueue()
https://bugs.webkit.org/show_bug.cgi?id=191911
<rdar://problem/46214871>

Reviewed by Antoine Quint.

Source/WebCore:

Implement WebGPUDevice::getQueue(), which creates a WebGPUQueue
instance if necessary. Also link WebGPUQueue to the existing
GPUQueue object, and expose the label IDL property.

This patch is based on some work from Justin Fan.

Test: webgpu/queue-creation.html

* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
    New files.

* Modules/webgpu/WebGPUCommandBuffer.h:
(WebCore::WebGPUCommandBuffer::commandBuffer const):
    Expose a GPUCommandBuffer getter, used when submitting (even though
    the actual GPU submission isn't implemented yet).

* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::getQueue):
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUDevice.idl:
    Implement getQueue().

* Modules/webgpu/WebGPUQueue.cpp:
(WebCore::WebGPUQueue::create):
(WebCore::WebGPUQueue::WebGPUQueue):
(WebCore::WebGPUQueue::submit):
* Modules/webgpu/WebGPUQueue.h:
(WebCore::WebGPUQueue::label const):
(WebCore::WebGPUQueue::setLabel):
* Modules/webgpu/WebGPUQueue.idl:
    New class. Mostly sends stuff onto GPUQueue.

* bindings/js/WebCoreBuiltinNames.h:
    Add WebGPUQueue.

* platform/graphics/gpu/GPUQueue.h:
* platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
(WebCore::GPUQueue::create):
(WebCore::GPUQueue::submit):
(WebCore::GPUQueue::label const):
(WebCore::GPUQueue::setLabel const):
    "label" getter/setter that uses
    the underlying MTLCommandQueue label property, but prefixes
    it with a WebKit identifier, so it can be correctly
    identified in system crash logs as coming from WebGPU.

LayoutTests:

WPT-style test for queue creation.

* webgpu/queue-creation-expected.txt: Added.
* webgpu/queue-creation.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/queue-creation-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/queue-creation.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h
Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
Source/WebCore/Modules/webgpu/WebGPUDevice.h
Source/WebCore/Modules/webgpu/WebGPUDevice.idl
Source/WebCore/Modules/webgpu/WebGPUQueue.cpp [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUQueue.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUQueue.idl [new file with mode: 0644]
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/platform/graphics/gpu/GPUQueue.h
Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm