[WebGPU] WebGPUCommandBuffer prototype
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2018 21:20:27 +0000 (21:20 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2018 21:20:27 +0000 (21:20 +0000)
commit3219f4ca29a5c78b88ab93750162c989777ff3fb
tree6f78c8f691d7e405f0e6f5a194fa89281755f747
parentdbdecd3a32d94c635c9d4a9ed4cb2d8d781c91d3
[WebGPU] WebGPUCommandBuffer prototype
https://bugs.webkit.org/show_bug.cgi?id=191663

Reviewed by Dean Jackson.

Begin implementation of WebGPUCommandBuffers as well as GPUQueues (MTLCommandBuffer, MTLCommandQueue).

Source/WebCore:

Test: webgpu/command-buffers.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/webgpu/GPUCommandBuffer.h: Added. Wrapper class around a MTLCommandBuffer.
* Modules/webgpu/GPUDevice.cpp:
(WebCore::GPUDevice::createCommandBuffer): Added.
(WebCore::GPUDevice::getQueue): Returns RefPtr to the device's singleton queue.
* Modules/webgpu/GPUDevice.h: Now manages the device's GPUQueue.
(WebCore::GPUDevice::platformDevice const):
* Modules/webgpu/GPUQueue.h: Added. Wrapper class around a MTLCommandQueue.
(WebCore::GPUQueue::platformQueue const):
* Modules/webgpu/GPURenderPipeline.h: Moved from Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h.
(WebCore::GPURenderPipeline::platformRenderPipeline const):
* Modules/webgpu/GPUShaderModule.h:
(WebCore::GPUShaderModule::platformShaderModule const):
* Modules/webgpu/GPUSwapChain.h: Moved from Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h.
(WebCore::GPUSwapChain::platformLayer const):
* Modules/webgpu/WebGPUCommandBuffer.cpp: Added. Web interface for a GPU device's command buffer.
(WebCore::WebGPUCommandBuffer::create):
(WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
* Modules/webgpu/WebGPUCommandBuffer.h: Added.
* Modules/webgpu/WebGPUCommandBuffer.idl: Added.
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createCommandBuffer const): Added.
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUDevice.idl:
* Modules/webgpu/cocoa/GPUCommandBufferMetal.mm: Added. MTLCommandBuffer impl for GPUCommandBuffer.
(WebCore::GPUCommandBuffer::create): Create a MTLCommandBuffer from the MTLCommandQueue.
(WebCore::GPUCommandBuffer::GPUCommandBuffer):
* Modules/webgpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::GPUDevice):
* Modules/webgpu/cocoa/GPUQueueMetal.mm: Added. MTLCommandQueue impl for GPUQueue.
(WebCore::GPUQueue::create):
(WebCore::GPUQueue::GPUQueue):
* Modules/webgpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::GPURenderPipeline::GPURenderPipeline):
* Modules/webgpu/cocoa/GPUShaderModuleMetal.mm:
(WebCore::GPUShaderModule::create):
(WebCore::GPUShaderModule::GPUShaderModule):
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

LayoutTests:

New testing for WebGPUCommandBuffers, to be fleshed out when WebGPUCommandBufferDescriptors
are added to the specification.

* webgpu/command-buffers-expected.txt: Added.
* webgpu/command-buffers.html: Basic functionality, with more stress tests to be added when the spec is updated.
* webgpu/webgpu-basics.html: Updated to create the command buffer used by later rendering operations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238245 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/command-buffers-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/command-buffers.html [new file with mode: 0644]
LayoutTests/webgpu/webgpu-basics.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webgpu/GPUCommandBuffer.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/GPUDevice.cpp
Source/WebCore/Modules/webgpu/GPUDevice.h
Source/WebCore/Modules/webgpu/GPUQueue.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/GPURenderPipeline.h [moved from Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h with 97% similarity]
Source/WebCore/Modules/webgpu/GPUShaderModule.h
Source/WebCore/Modules/webgpu/GPUSwapChain.h [moved from Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h with 96% similarity]
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
Source/WebCore/Modules/webgpu/WebGPUDevice.h
Source/WebCore/Modules/webgpu/WebGPUDevice.idl
Source/WebCore/Modules/webgpu/cocoa/GPUCommandBufferMetal.mm [new file with mode: 0644]
Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm
Source/WebCore/Modules/webgpu/cocoa/GPUQueueMetal.mm [new file with mode: 0644]
Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm
Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm
Source/WebCore/Sources.txt
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h