WebKit Bugzilla
Attachment 356827 Details for
Bug 192508
: [iOS] Make WebGPU work with remote layer hosting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192508-20181207115928.patch (text/plain), 14.95 KB, created by
Dean Jackson
on 2018-12-07 11:59:28 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dean Jackson
Created:
2018-12-07 11:59:28 PST
Size:
14.95 KB
patch
obsolete
>Subversion Revision: 238874 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3aa10644e717470f95d8380cb7470dff7664a5e2..310a7091b5ef956d21227a814bf5e11cadca1eae 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,41 @@ >+2018-12-07 Dean Jackson <dino@apple.com> >+ >+ [iOS] Make WebGPU work with remote layer hosting >+ https://bugs.webkit.org/show_bug.cgi?id=192508 >+ <rdar://problem/46560649> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ > 2018-12-04 Youenn Fablet <youenn@apple.com> > > Fix MediaRecorder flaky tests >diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 4fefca3cbd1cdccde3ab418a09d7fe5a14741279..4fbd1101223ae1b0a06fe8de3d2cc40d16be4d32 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -309,6 +309,7 @@ platform/graphics/cocoa/WebActionDisablingCALayerDelegate.mm > platform/graphics/cocoa/WebCoreCALayerExtras.mm > platform/graphics/cocoa/WebCoreDecompressionSession.mm > platform/graphics/cocoa/WebGLLayer.mm >+platform/graphics/cocoa/WebGPULayer.mm > platform/graphics/cocoa/WebMetalLayer.mm > platform/graphics/cocoa/TextTrackRepresentationCocoa.mm > >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 7a26ffcd9eb754841d82e885db6127135e565da9..ad6c4ea609c6001a8afaba546b5292253dc4e8ca 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -963,6 +963,7 @@ > 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 317D3FF3215599F40034E3B9 /* PointerEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 317D3FF2215599E30034E3B9 /* PointerEvent.h */; }; > 31815A311F9A6C8F00FCBF89 /* ImageBitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D26BBF1F86D189008FF255 /* ImageBitmap.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 318436DE21B9DAAF00ED383E /* WebGPULayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 318436DB21B9DAA000ED383E /* WebGPULayer.h */; }; > 318891611AB7EEA100EA627B /* missingImage@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = CDF419991AB0DA14004E64E1 /* missingImage@3x.png */; }; > 318EAD4D1FA91380008CEF86 /* ImageBitmapRenderingContextSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 318EAD4A1FA91157008CEF86 /* ImageBitmapRenderingContextSettings.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 31955A88160D199200858025 /* RenderSnapshottedPlugIn.h in Headers */ = {isa = PBXBuildFile; fileRef = 31E8D8BB160BC94C004CE8F5 /* RenderSnapshottedPlugIn.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -7023,6 +7024,8 @@ > 317D3FEF215599E10034E3B9 /* PointerEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PointerEvent.idl; sourceTree = "<group>"; }; > 317D3FF1215599E20034E3B9 /* PointerEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PointerEvent.cpp; sourceTree = "<group>"; }; > 317D3FF2215599E30034E3B9 /* PointerEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PointerEvent.h; sourceTree = "<group>"; }; >+ 318436DB21B9DAA000ED383E /* WebGPULayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPULayer.h; sourceTree = "<group>"; }; >+ 318436DD21B9DAA000ED383E /* WebGPULayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGPULayer.mm; sourceTree = "<group>"; }; > 3189E6DB16B2103500386EA3 /* plugIns.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = plugIns.css; sourceTree = "<group>"; }; > 318EAD4A1FA91157008CEF86 /* ImageBitmapRenderingContextSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBitmapRenderingContextSettings.h; sourceTree = "<group>"; }; > 318EAD4C1FA91352008CEF86 /* ImageBitmapRenderingContextSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ImageBitmapRenderingContextSettings.idl; sourceTree = "<group>"; }; >@@ -24437,6 +24440,8 @@ > CD5D27751E8318E000D80A3D /* WebCoreDecompressionSession.mm */, > 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */, > 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */, >+ 318436DB21B9DAA000ED383E /* WebGPULayer.h */, >+ 318436DD21B9DAA000ED383E /* WebGPULayer.mm */, > 316BDB8A1E6E153000DE0D5A /* WebMetalLayer.h */, > D045AD1D2168230B000A6E9B /* WebMetalLayer.mm */, > ); >@@ -28011,8 +28016,8 @@ > CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */, > CDE595971BF26E2100A1CBE8 /* CDMSessionMediaSourceAVFObjC.h in Headers */, > 5FA904CA178E61F5004C8A2D /* CertificateInfo.h in Headers */, >- 91B8F0B521953D65000C2B00 /* CertificateInfoBase.h in Headers */, >- FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */, >+ 91B8F0B521953D65000C2B00 /* CertificateInfoBase.h in Headers */, >+ FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */, > 97BC69DD1505F076001B74AC /* ChangeVersionWrapper.h in Headers */, > FD315FFF12B0267600C1A359 /* ChannelMergerNode.h in Headers */, > FD31600212B0267600C1A359 /* ChannelSplitterNode.h in Headers */, >@@ -31679,6 +31684,7 @@ > 0C3F1F5B10C8871200D72CE1 /* WebGLUniformLocation.h in Headers */, > 6F995A261A7078B100A735F4 /* WebGLVertexArrayObject.h in Headers */, > 77A17A7812F28642004E02F6 /* WebGLVertexArrayObjectOES.h in Headers */, >+ 318436DE21B9DAAF00ED383E /* WebGPULayer.h in Headers */, > A5B81CB71FAA44620037D1E6 /* WebHeapAgent.h in Headers */, > A5840E25187B8AC200843B10 /* WebInjectedScriptHost.h in Headers */, > A584FE301864CB8400843B10 /* WebInjectedScriptManager.h in Headers */, >diff --git a/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm b/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm >index 419ca63e7ae963eb37325141e19fc9dfc70e7d78..b2bddae251130770c2db9c60900b20cad41b9929 100644 >--- a/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm >+++ b/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm >@@ -38,6 +38,9 @@ > #import "WebActionDisablingCALayerDelegate.h" > #import "WebCoreCALayerExtras.h" > #import "WebGLLayer.h" >+#if ENABLE(WEBGPU) >+#import "WebGPULayer.h" >+#endif > #import <pal/spi/cocoa/QuartzCoreSPI.h> > #import <wtf/SoftLinking.h> > #if ENABLE(WEBMETAL) >@@ -203,6 +206,11 @@ PlatformCALayer::LayerType PlatformCALayerCocoa::layerTypeForPlatformLayer(Platf > if ([layer isKindOfClass:[WebGLLayer class]]) > return LayerTypeContentsProvidedLayer; > >+#if ENABLE(WEBGPU) >+ if ([layer isKindOfClass:[WebGPULayer class]]) >+ return LayerTypeContentsProvidedLayer; >+#endif >+ > #if ENABLE(WEBMETAL) > if ([layer isKindOfClass:[WebMetalLayer class]]) > return LayerTypeContentsProvidedLayer; >@@ -260,7 +268,7 @@ PlatformCALayerCocoa::PlatformCALayerCocoa(LayerType layerType, PlatformCALayerC > layerClass = getAVPlayerLayerClass(); > break; > case LayerTypeContentsProvidedLayer: >- // We don't create PlatformCALayerCocoas wrapped around WebGLLayers or WebMetalLayers. >+ // We don't create PlatformCALayerCocoas wrapped around WebGLLayers, WebGPULayers or WebMetalLayers. > ASSERT_NOT_REACHED(); > break; > case LayerTypeShapeLayer: >diff --git a/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h b/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h >new file mode 100644 >index 0000000000000000000000000000000000000000..37f1a22fca1c867d8248fa202fe7c5b8fe68fb3c >--- /dev/null >+++ b/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#import <Metal/Metal.h> >+ >+namespace WebCore { >+class GPUSwapChain; >+} >+ >+@interface WebGPULayer : CAMetalLayer { >+ WebCore::GPUSwapChain* _swapChain; >+ float _devicePixelRatio; >+} >+ >+@property (nonatomic) WebCore::GPUSwapChain* swapChain; >+ >+- (id)init; >+ >+- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace; >+ >+@end >+ >+#endif >diff --git a/Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm b/Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..2987381d9f5525e8be86340ccea3ea460744cc2c >--- /dev/null >+++ b/Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#import "WebGPULayer.h" >+ >+#if ENABLE(WEBGPU) >+ >+#import "GPUSwapChain.h" >+#import "GraphicsContextCG.h" >+ >+@implementation WebGPULayer >+ >+@synthesize swapChain=_swapChain; >+ >+- (id)init >+{ >+ self = [super init]; >+ >+ // FIXME: WebGPU - handle retina correctly. >+ _devicePixelRatio = 1; >+ >+#if PLATFORM(MAC) >+ self.contentsScale = _devicePixelRatio; >+ self.colorspace = WebCore::sRGBColorSpaceRef(); >+#endif >+ return self; >+} >+ >+- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace >+{ >+ if (!_swapChain) >+ return nullptr; >+ >+ UNUSED_PARAM(colorSpace); >+ return nullptr; >+} >+ >+@end >+ >+#endif >diff --git a/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h b/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h >index aa9ad267f4974f8798ece7e2a6d7751a478e0647..d8202cb20923f7acea3f95b67ce1fbfcac413165 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h >+++ b/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h >@@ -32,7 +32,7 @@ > #include <wtf/RetainPtr.h> > > OBJC_CLASS CALayer; >-OBJC_CLASS CAMetalLayer; >+OBJC_CLASS WebGPULayer; > OBJC_PROTOCOL(CAMetalDrawable); > > namespace WebCore { >@@ -43,7 +43,7 @@ enum class GPUTextureFormatEnum; > > using PlatformDrawableSmartPtr = RetainPtr<CAMetalDrawable>; > using PlatformLayer = CALayer; >-using PlatformSwapLayerSmartPtr = RetainPtr<CAMetalLayer>; >+using PlatformSwapLayerSmartPtr = RetainPtr<WebGPULayer>; > > class GPUSwapChain : public RefCounted<GPUSwapChain> { > public: >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >index 6d482e6f1686ab415efb50b26bb70e13ddc67f1e..95bdfd179e7d36c2d062b7888bff827d954e394e 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >@@ -32,6 +32,7 @@ > #import "GPUTexture.h" > #import "GPUTextureFormatEnum.h" > #import "Logging.h" >+#import "WebGPULayer.h" > > #import <Metal/Metal.h> > #import <QuartzCore/QuartzCore.h> >@@ -45,7 +46,7 @@ RefPtr<GPUSwapChain> GPUSwapChain::create() > > BEGIN_BLOCK_OBJC_EXCEPTIONS; > >- platformLayer = adoptNS([[CAMetalLayer alloc] init]); >+ platformLayer = adoptNS([[WebGPULayer alloc] init]); > > [platformLayer setOpaque:0]; > [platformLayer setName:@"WebGPU Layer"]; >@@ -66,6 +67,7 @@ RefPtr<GPUSwapChain> GPUSwapChain::create() > GPUSwapChain::GPUSwapChain(PlatformSwapLayerSmartPtr&& platformLayer) > : m_platformSwapLayer(WTFMove(platformLayer)) > { >+ platformLayer.get().swapChain = this; > } > > void GPUSwapChain::setDevice(const GPUDevice& device)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192508
: 356827 |
356828