[iOS] Make WebGPU work with remote layer hosting
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Dec 2018 19:37:49 +0000 (19:37 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Dec 2018 19:37:49 +0000 (19:37 +0000)
commit6c6fee336db4741ed43450899ad77f9c3173b8dc
tree60641874e9c6609ebfc3f7389faa185ede9109e3
parentab63f09283f43f90cdd5f182987512f7919b57dc
[iOS] Make WebGPU work with remote layer hosting
https://bugs.webkit.org/show_bug.cgi?id=192508
<rdar://problem/46560649>

Reviewed by Tim Horton.

WebGPU wasn't working on iOS because we were not correctly
identifying the CALayers for remote hosting. Fix this by
adding a new CALayer type, WebGPULayer. This will also
eventually hold the code to render WebGPU into a canvas.

Covered by the existing reference tests (on device).

* SourcesCocoa.txt: Add new files.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Recognise the WebGPULayer
class for remote hosting.
(WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
(WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):

* platform/graphics/cocoa/WebGPULayer.h: Added. Very simple inheritance
from CAMetalLayer.
* platform/graphics/cocoa/WebGPULayer.mm: Added.
(-[WebGPULayer init]):
(-[WebGPULayer copyImageSnapshotWithColorSpace:]):

* platform/graphics/gpu/GPUSwapChain.h: Reference WebGPULayer rather
than CALayer.

* platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: Ensure that
the WebGPULayer has a reference back to this object, which it
will use in the future.
(WebCore::GPUSwapChain::create):
(WebCore::GPUSwapChain::GPUSwapChain):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/platform/graphics/cocoa/WebGPULayer.h [new file with mode: 0644]
Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUSwapChain.h
Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm