Title: [213541] trunk
Revision
213541
Author
[email protected]
Date
2017-03-07 14:23:33 -0800 (Tue, 07 Mar 2017)

Log Message

Add GPUDevice implementation and WebGPULayer
https://bugs.webkit.org/show_bug.cgi?id=169219
<rdar://problem/30879048>

Reviewed by Sam Weinig.

Source/WebCore:

Add a basic implementation of a GPUDevice object,
which references a MTLDevice. Also add a WebGPULayer
that will ultimately be used to host WebGPU content.

WebKit API Test: WebCore/mac/GPUDevice.mm

* Configurations/WebCore.xcconfig: Link to Metal.

* PlatformMac.cmake: New files.
* WebCore.xcodeproj/project.pbxproj:

* platform/Logging.h: Add a WebGPU logging channel.

* platform/graphics/cocoa/GPUDeviceMetal.mm: Added.
(WebCore::GPUDevice::GPUDevice): Cocoa implementation.
(WebCore::GPUDevice::reshape):
* platform/graphics/cocoa/WebGPULayer.h: Added.
* platform/graphics/cocoa/WebGPULayer.mm: Added.
(-[WebGPULayer initWithGPUDevice:]):
(-[WebGPULayer copyImageSnapshotWithColorSpace:]):
(-[WebGPULayer display]):
* platform/graphics/gpu/GPUDevice.cpp: Added.
(WebCore::GPUDevice::create):
(WebCore::GPUDevice::~GPUDevice):
(WebCore::GPUDevice::GPUDevice): Implementation for platforms
other than Mac and iOS hardware.
(WebCore::GPUDevice::reshape):
* platform/graphics/gpu/GPUDevice.h: Added.
(WebCore::GPUDevice::platformLayer):
(WebCore::GPUDevice::platformDevice):
(WebCore::GPUDevice::layer):

Tools:

Test for WebCore's GPUDevice class.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm: Added.
(TestWebKitAPI::TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213540 => 213541)


--- trunk/Source/WebCore/ChangeLog	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Source/WebCore/ChangeLog	2017-03-07 22:23:33 UTC (rev 213541)
@@ -1,3 +1,43 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Add GPUDevice implementation and WebGPULayer
+        https://bugs.webkit.org/show_bug.cgi?id=169219
+        <rdar://problem/30879048>
+
+        Reviewed by Sam Weinig.
+
+        Add a basic implementation of a GPUDevice object,
+        which references a MTLDevice. Also add a WebGPULayer
+        that will ultimately be used to host WebGPU content.
+
+        WebKit API Test: WebCore/mac/GPUDevice.mm
+
+        * Configurations/WebCore.xcconfig: Link to Metal.
+
+        * PlatformMac.cmake: New files.
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * platform/Logging.h: Add a WebGPU logging channel.
+
+        * platform/graphics/cocoa/GPUDeviceMetal.mm: Added.
+        (WebCore::GPUDevice::GPUDevice): Cocoa implementation.
+        (WebCore::GPUDevice::reshape):
+        * platform/graphics/cocoa/WebGPULayer.h: Added.
+        * platform/graphics/cocoa/WebGPULayer.mm: Added.
+        (-[WebGPULayer initWithGPUDevice:]):
+        (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
+        (-[WebGPULayer display]):
+        * platform/graphics/gpu/GPUDevice.cpp: Added.
+        (WebCore::GPUDevice::create):
+        (WebCore::GPUDevice::~GPUDevice):
+        (WebCore::GPUDevice::GPUDevice): Implementation for platforms
+        other than Mac and iOS hardware.
+        (WebCore::GPUDevice::reshape):
+        * platform/graphics/gpu/GPUDevice.h: Added.
+        (WebCore::GPUDevice::platformLayer):
+        (WebCore::GPUDevice::platformDevice):
+        (WebCore::GPUDevice::layer):
+
 2017-03-07  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Log an error to the console when an image fails to load

Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (213540 => 213541)


--- trunk/Source/WebCore/Configurations/WebCore.xcconfig	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig	2017-03-07 22:23:33 UTC (rev 213541)
@@ -78,7 +78,7 @@
 LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
 
 OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_PLATFORM)
-OTHER_LDFLAGS_BASE = -lsqlite3 -lobjc -lANGLE;
+OTHER_LDFLAGS_BASE = -lsqlite3 -lobjc -lANGLE -framework Metal;
 OTHER_LDFLAGS_BASE_ios = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework MobileCoreServices -framework OpenGLES -lMobileGestalt $(WK_IOS_BINCOMPAT_LDFLAGS);
 OTHER_LDFLAGS_PLATFORM[sdk=iphoneos*] = $(OTHER_LDFLAGS_BASE_ios) -framework IOSurface -framework GraphicsServices $(LIBWEBRTC_LDFLAGS);
 OTHER_LDFLAGS_PLATFORM[sdk=iphonesimulator*] = $(OTHER_LDFLAGS_BASE_ios) $(LIBWEBRTC_LDFLAGS);

Modified: trunk/Source/WebCore/PlatformMac.cmake (213540 => 213541)


--- trunk/Source/WebCore/PlatformMac.cmake	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Source/WebCore/PlatformMac.cmake	2017-03-07 22:23:33 UTC (rev 213541)
@@ -107,6 +107,7 @@
     "${WEBCORE_DIR}/platform/graphics/cocoa"
     "${WEBCORE_DIR}/platform/graphics/cg"
     "${WEBCORE_DIR}/platform/graphics/cv"
+    "${WEBCORE_DIR}/platform/graphics/gpu"
     "${WEBCORE_DIR}/platform/graphics/egl"
     "${WEBCORE_DIR}/platform/graphics/opentype"
     "${WEBCORE_DIR}/platform/graphics/opengl"
@@ -414,6 +415,7 @@
     platform/graphics/cg/SubimageCacheWithTimer.cpp
     platform/graphics/cg/TransformationMatrixCG.cpp
 
+    platform/graphics/cocoa/GPUDeviceMetal.mm
     platform/graphics/cocoa/FontCacheCoreText.cpp
     platform/graphics/cocoa/FontCascadeCocoa.mm
     platform/graphics/cocoa/FontCocoa.mm
@@ -427,6 +429,8 @@
     platform/graphics/cv/TextureCacheCV.mm
     platform/graphics/cv/VideoTextureCopierCV.cpp
 
+    platform/graphics/gpu/GPUDevice.cpp
+
     platform/graphics/mac/ColorMac.mm
     platform/graphics/mac/ComplexTextControllerCoreText.mm
     platform/graphics/mac/DisplayRefreshMonitorMac.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213540 => 213541)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-03-07 22:23:33 UTC (rev 213541)
@@ -1352,6 +1352,11 @@
 		314BE3A31B30F6D100141982 /* CSSNamedImageValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 314BE3A21B30F6D100141982 /* CSSNamedImageValue.cpp */; };
 		314BE3A61B3103FB00141982 /* NamedImageGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 314BE3A41B3103FB00141982 /* NamedImageGeneratedImage.cpp */; };
 		314BE3A71B3103FB00141982 /* NamedImageGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 314BE3A51B3103FB00141982 /* NamedImageGeneratedImage.h */; };
+		316BDB861E6E0A2700DE0D5A /* GPUDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 316BDB851E6E0A2100DE0D5A /* GPUDevice.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		316BDB871E6E0A2C00DE0D5A /* GPUDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316BDB841E6E0A2100DE0D5A /* GPUDevice.cpp */; };
+		316BDB8B1E6E153000DE0D5A /* WebGPULayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 316BDB891E6E153000DE0D5A /* WebGPULayer.mm */; };
+		316BDB8C1E6E153000DE0D5A /* WebGPULayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 316BDB8A1E6E153000DE0D5A /* WebGPULayer.h */; };
+		316BDB8D1E6E189800DE0D5A /* GPUDeviceMetal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 316BDB881E6E141C00DE0D5A /* GPUDeviceMetal.mm */; };
 		316FE0710E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */; };
 		316FE0720E6CCBEE00BF6088 /* JSCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */; };
 		316FE0730E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06F0E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp */; };
@@ -8664,6 +8669,11 @@
 		314BE3A21B30F6D100141982 /* CSSNamedImageValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSNamedImageValue.cpp; sourceTree = "<group>"; };
 		314BE3A41B3103FB00141982 /* NamedImageGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NamedImageGeneratedImage.cpp; sourceTree = "<group>"; };
 		314BE3A51B3103FB00141982 /* NamedImageGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NamedImageGeneratedImage.h; sourceTree = "<group>"; };
+		316BDB841E6E0A2100DE0D5A /* GPUDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GPUDevice.cpp; sourceTree = "<group>"; };
+		316BDB851E6E0A2100DE0D5A /* GPUDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUDevice.h; sourceTree = "<group>"; };
+		316BDB881E6E141C00DE0D5A /* GPUDeviceMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUDeviceMetal.mm; sourceTree = "<group>"; };
+		316BDB891E6E153000DE0D5A /* WebGPULayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGPULayer.mm; sourceTree = "<group>"; };
+		316BDB8A1E6E153000DE0D5A /* WebGPULayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPULayer.h; sourceTree = "<group>"; };
 		316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSKeyframeRule.cpp; sourceTree = "<group>"; };
 		316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSKeyframeRule.h; sourceTree = "<group>"; };
 		316FE06F0E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSKeyframesRule.cpp; sourceTree = "<group>"; };
@@ -17436,6 +17446,8 @@
 		498770C11242C50D002226BA /* gpu */ = {
 			isa = PBXGroup;
 			children = (
+				316BDB841E6E0A2100DE0D5A /* GPUDevice.cpp */,
+				316BDB851E6E0A2100DE0D5A /* GPUDevice.h */,
 				498770D71242C535002226BA /* Texture.cpp */,
 				498770D81242C535002226BA /* Texture.h */,
 				498770D91242C535002226BA /* TilingData.cpp */,
@@ -22527,6 +22539,7 @@
 				B2AFFC780D00A5C10030074D /* FontCascadeCocoa.mm */,
 				7C4EDD731A7B607800198C4D /* FontCocoa.mm */,
 				B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */,
+				316BDB881E6E141C00DE0D5A /* GPUDeviceMetal.mm */,
 				2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */,
 				2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
 				AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
@@ -22536,6 +22549,8 @@
 				2D3EF4451917915C00034184 /* WebActionDisablingCALayerDelegate.mm */,
 				2D3EF4461917915C00034184 /* WebCoreCALayerExtras.h */,
 				2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */,
+				316BDB891E6E153000DE0D5A /* WebGPULayer.mm */,
+				316BDB8A1E6E153000DE0D5A /* WebGPULayer.h */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";
@@ -27195,6 +27210,7 @@
 				19BFF64F11C0F2AC00B8C04D /* JSSVGFEConvolveMatrixElement.h in Headers */,
 				B2FA3D730AB75A6F000E5AC4 /* JSSVGFEDiffuseLightingElement.h in Headers */,
 				B2FA3D750AB75A6F000E5AC4 /* JSSVGFEDisplacementMapElement.h in Headers */,
+				316BDB8C1E6E153000DE0D5A /* WebGPULayer.h in Headers */,
 				B2FA3D770AB75A6F000E5AC4 /* JSSVGFEDistantLightElement.h in Headers */,
 				4358E87D1360A2EE00E4748C /* JSSVGFEDropShadowElement.h in Headers */,
 				B2FA3D790AB75A6F000E5AC4 /* JSSVGFEFloodElement.h in Headers */,
@@ -27547,6 +27563,7 @@
 				D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */,
 				D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
 				9493B6C11D74B4120088E780 /* MediaQueryParser.h in Headers */,
+				316BDB861E6E0A2700DE0D5A /* GPUDevice.h in Headers */,
 				C90843D01B18E47D00B68564 /* MediaRemoteControls.h in Headers */,
 				CD8ACA8F1D23971900ECC59E /* MediaRemoteSoftLink.h in Headers */,
 				CD8ACA8B1D23946400ECC59E /* MediaRemoteSPI.h in Headers */,
@@ -29921,6 +29938,7 @@
 				62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */,
 				97BC6A201505F081001B74AC /* Database.cpp in Sources */,
 				97BC6A231505F081001B74AC /* DatabaseAuthorizer.cpp in Sources */,
+				316BDB8B1E6E153000DE0D5A /* WebGPULayer.mm in Sources */,
 				97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */,
 				FE456F181677D74E005EDDF9 /* DatabaseManager.cpp in Sources */,
 				1ACB2B231A5733F400333392 /* DatabaseProvider.cpp in Sources */,
@@ -30502,6 +30520,7 @@
 				A5840E1C187B74D500843B10 /* InspectorInstrumentationCookie.cpp in Sources */,
 				71B1E1261640491A00B1880A /* InspectorLayerTreeAgent.cpp in Sources */,
 				A5071E801C506B66009951BE /* InspectorMemoryAgent.cpp in Sources */,
+				316BDB8D1E6E189800DE0D5A /* GPUDeviceMetal.mm in Sources */,
 				82AB1775125C826700C5069D /* InspectorNetworkAgent.cpp in Sources */,
 				504AACCD1834455900E3D9BC /* InspectorNodeFinder.cpp in Sources */,
 				7C522D4B15B477E8009B7C95 /* InspectorOverlay.cpp in Sources */,
@@ -31461,6 +31480,7 @@
 				07FFDE68181AED420072D409 /* MediaStreamTrackPrivate.cpp in Sources */,
 				CD641EBF1819B36000EE4C41 /* MediaTimeAVFoundation.cpp in Sources */,
 				CD60C0C6193E87C7003C656B /* MediaTimeQTKit.mm in Sources */,
+				316BDB871E6E0A2C00DE0D5A /* GPUDevice.cpp in Sources */,
 				932CC0F71DFFDA1F004C0F9F /* MediaTrackConstraints.cpp in Sources */,
 				99C7CCB518C6B8990032E413 /* MemoizedDOMResult.cpp in Sources */,
 				51E1BAC21BD8064E0055D81F /* MemoryBackingStoreTransaction.cpp in Sources */,

Modified: trunk/Source/WebCore/platform/Logging.h (213540 => 213541)


--- trunk/Source/WebCore/platform/Logging.h	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Source/WebCore/platform/Logging.h	2017-03-07 22:23:33 UTC (rev 213541)
@@ -87,6 +87,7 @@
     M(URLParser) \
     M(WebAudio) \
     M(WebGL) \
+    M(WebGPU) \
     M(WebRTC) \
     M(WebReplay) \
     M(WheelEventTestTriggers) \

Added: trunk/Source/WebCore/platform/graphics/cocoa/GPUDeviceMetal.mm (0 => 213541)


--- trunk/Source/WebCore/platform/graphics/cocoa/GPUDeviceMetal.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GPUDeviceMetal.mm	2017-03-07 22:23:33 UTC (rev 213541)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#import "config.h"
+#import "GPUDevice.h"
+
+#import "Logging.h"
+#import "WebGPULayer.h"
+
+#import <Metal/Metal.h>
+#import <runtime/ArrayBuffer.h>
+#import <wtf/BlockObjCExceptions.h>
+
+#if ENABLE(WEBGPU) && !PLATFORM(IOS_SIMULATOR)
+
+namespace WebCore {
+
+GPUDevice::GPUDevice()
+{
+    m_device = MTLCreateSystemDefaultDevice();
+    LOG(WebGPU, "GPUDevice::GPUDevice Metal device is %p", m_device.get());
+
+    if (!m_device) {
+        LOG(WebGPU, "GPUDevice::GPUDevice -- could not create the device");
+        return;
+    }
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS
+    m_layer = [[WebGPULayer alloc] initWithGPUDevice:this];
+    [m_layer setOpaque:0];
+    [m_layer setName:@"WebGPU Layer"];
+
+    // FIXME: WebGPU - Should this be in the WebGPULayer initializer?
+    [m_layer setDevice:(id<MTLDevice>)m_device.get()];
+    [m_layer setPixelFormat:MTLPixelFormatBGRA8Unorm];
+    [m_layer setFramebufferOnly:YES];
+    END_BLOCK_OBJC_EXCEPTIONS
+}
+
+void GPUDevice::reshape(int width, int height)
+{
+    if (!m_device)
+        return;
+
+    if (m_layer) {
+        [m_layer setBounds:CGRectMake(0, 0, width, height)];
+        [m_layer setDrawableSize:CGSizeMake(width, height)];
+    }
+
+    // FIXME: WebGPU - Lots of reshape stuff should go here. See GC3D.
+}
+
+} // namespace WebCore
+
+#endif

Added: trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h (0 => 213541)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h	2017-03-07 22:23:33 UTC (rev 213541)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 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>
+#import <QuartzCore/QuartzCore.h>
+
+namespace WebCore {
+class GPUDevice;
+}
+
+#if !PLATFORM(IOS_SIMULATOR)
+@interface WebGPULayer : CAMetalLayer {
+#else
+@interface WebGPULayer : CALayer { // FIXME: WebGPU - Disable WebGPU on iOS simulator?
+#endif
+    WebCore::GPUDevice* _context;
+    float _devicePixelRatio;
+}
+
+@property (nonatomic) WebCore::GPUDevice* context;
+
+- (id)initWithGPUDevice:(WebCore::GPUDevice*)context;
+
+- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace;
+
+@end
+
+#endif
Property changes on: trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.h
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Added: trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm (0 => 213541)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGPULayer.mm	2017-03-07 22:23:33 UTC (rev 213541)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2015 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 "GPUDevice.h"
+#import "GraphicsContextCG.h"
+#import "GraphicsLayer.h"
+#import <wtf/FastMalloc.h>
+#import <wtf/RetainPtr.h>
+
+using namespace WebCore;
+
+@implementation WebGPULayer
+
+@synthesize context=_context;
+
+- (id)initWithGPUDevice:(GPUDevice*)context
+{
+    self = [super init];
+    _context = context;
+
+    // FIXME: WebGPU - handle retina correctly.
+    _devicePixelRatio = 1;
+
+#if PLATFORM(MAC)
+    self.contentsScale = _devicePixelRatio;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    if ([self respondsToSelector:@selector(setColorspace:)])
+        [self setColorspace:sRGBColorSpaceRef()];
+#endif
+#endif
+    return self;
+}
+
+- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace
+{
+    if (!_context)
+        return nullptr;
+
+    UNUSED_PARAM(colorSpace);
+    return nullptr;
+}
+
+- (void)display
+{
+    // This is a no-op. We don't need to
+    // call display - instead we present
+    // a drawable from our context.
+}
+
+@end
+
+#endif

Added: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp (0 => 213541)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp	2017-03-07 22:23:33 UTC (rev 213541)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#import "config.h"
+#import "GPUDevice.h"
+
+#if ENABLE(WEBGPU)
+
+#import "Logging.h"
+
+namespace WebCore {
+
+RefPtr<GPUDevice> GPUDevice::create()
+{
+    RefPtr<GPUDevice> device = adoptRef(new GPUDevice());
+    LOG(WebGPU, "GPUDevice::create() device is %p", device.get());
+    return device;
+}
+
+GPUDevice::~GPUDevice()
+{
+    LOG(WebGPU, "GPUDevice::~GPUDevice()");
+}
+
+#if !PLATFORM(COCOA) || PLATFORM(IOS_SIMULATOR)
+
+GPUDevice::GPUDevice()
+{
+
+}
+
+void GPUDevice::reshape(int, int)
+{
+}
+
+#endif
+
+} // namespace WebCore
+
+#endif
Property changes on: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Added: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h (0 => 213541)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h	2017-03-07 22:23:33 UTC (rev 213541)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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)
+
+#include "PlatformLayer.h"
+#include <runtime/ArrayBufferView.h>
+#include <wtf/RefCounted.h>
+
+#if USE(CA)
+#include "PlatformCALayer.h"
+#endif
+
+#if PLATFORM(COCOA)
+typedef struct objc_object* id;
+OBJC_CLASS CALayer;
+OBJC_CLASS WebGPULayer;
+#else
+class WebGPULayer;
+typedef void PlatformGPUDevice;
+#endif
+
+namespace WebCore {
+
+class GPUDevice : public RefCounted<GPUDevice> {
+public:
+
+    WEBCORE_EXPORT static RefPtr<GPUDevice> create();
+    WEBCORE_EXPORT ~GPUDevice();
+
+    void reshape(int width, int height);
+
+#if PLATFORM(COCOA)
+    CALayer* platformLayer() const { return reinterpret_cast<CALayer*>(m_layer.get()); }
+    WEBCORE_EXPORT id platformDevice() { return m_device.get(); }
+#endif
+
+    WebGPULayer* layer() { return m_layer.get(); }
+
+private:
+    GPUDevice();
+
+    RetainPtr<WebGPULayer> m_layer;
+#if PLATFORM(COCOA)
+    RetainPtr<id> m_device;
+#endif
+};
+
+} // namespace WebCore
+
+#endif
Property changes on: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Modified: trunk/Tools/ChangeLog (213540 => 213541)


--- trunk/Tools/ChangeLog	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Tools/ChangeLog	2017-03-07 22:23:33 UTC (rev 213541)
@@ -1,3 +1,17 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Add GPUDevice implementation and WebGPULayer
+        https://bugs.webkit.org/show_bug.cgi?id=169219
+        <rdar://problem/30879048>
+
+        Reviewed by Sam Weinig.
+
+        Test for WebCore's GPUDevice class.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm: Added.
+        (TestWebKitAPI::TEST):
+
 2017-03-07  Alex Christensen  <[email protected]>
 
         [Content Extensions] Rename "Domain" to "Condition" where appropriate

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (213540 => 213541)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-03-07 22:22:32 UTC (rev 213540)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-03-07 22:23:33 UTC (rev 213541)
@@ -93,6 +93,7 @@
 		2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */; };
 		2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */; };
 		315118101DB1AE4000176304 /* ExtendedColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3151180F1DB1ADD500176304 /* ExtendedColor.cpp */; };
+		3162AE9C1E6F2FF5000E4DBC /* GPUDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3162AE9B1E6F2FCE000E4DBC /* GPUDevice.mm */; };
 		33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; };
 		33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; };
 		33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
@@ -946,6 +947,7 @@
 		2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestWKWebView.mm; path = cocoa/TestWKWebView.mm; sourceTree = "<group>"; };
 		2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewCandidateTests.mm; sourceTree = "<group>"; };
 		3151180F1DB1ADD500176304 /* ExtendedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtendedColor.cpp; sourceTree = "<group>"; };
+		3162AE9B1E6F2FCE000E4DBC /* GPUDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUDevice.mm; sourceTree = "<group>"; };
 		333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; };
 		33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; };
 		33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash_Bundle.cpp; sourceTree = "<group>"; };
@@ -1660,21 +1662,23 @@
 			path = ios;
 			sourceTree = "<group>";
 		};
+		3162AE9A1E6F2F8F000E4DBC /* mac */ = {
+			isa = PBXGroup;
+			children = (
+				3162AE9B1E6F2FCE000E4DBC /* GPUDevice.mm */,
+			);
+			path = mac;
+			sourceTree = "<group>";
+		};
 		440A1D3614A01000008A66F2 /* WebCore */ = {
 			isa = PBXGroup;
 			children = (
-				8E4A85361E1D1AA100F53B0F /* GridPosition.cpp */,
-				CD89D0371C4EDB1300040A04 /* cocoa */,
 				7A909A6F1D877475007E10F8 /* AffineTransform.cpp */,
+				93A720E518F1A0E800A848E1 /* CalculationValue.cpp */,
 				07C046C91E42573E007201E7 /* CARingBuffer.cpp */,
-				7A909A701D877475007E10F8 /* FloatPoint.cpp */,
-				7A909A711D877475007E10F8 /* FloatRect.cpp */,
-				7A909A721D877475007E10F8 /* FloatSize.cpp */,
-				7A909A731D877475007E10F8 /* IntPoint.cpp */,
-				7A909A741D877475007E10F8 /* IntRect.cpp */,
-				7A909A751D877475007E10F8 /* IntSize.cpp */,
-				93A720E518F1A0E800A848E1 /* CalculationValue.cpp */,
+				CD89D0371C4EDB1300040A04 /* cocoa */,
 				7C3965051CDD74F90094DBB8 /* Color.cpp */,
+				1C9EB8401E380DA1005C6442 /* ComplexTextController.cpp */,
 				7CB184C41AA3F2100066EDFD /* ContentExtensions.cpp */,
 				CD5451E919E41F9D0016936F /* CSSParser.cpp */,
 				260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */,
@@ -1682,8 +1686,17 @@
 				26F6E1EF1ADC749B00DE696B /* DFAMinimizer.cpp */,
 				3151180F1DB1ADD500176304 /* ExtendedColor.cpp */,
 				41973B5A1AF2286A006C7B36 /* FileSystem.cpp */,
+				7A909A701D877475007E10F8 /* FloatPoint.cpp */,
+				7A909A711D877475007E10F8 /* FloatRect.cpp */,
+				7A909A721D877475007E10F8 /* FloatSize.cpp */,
+				1CAD1F851E5CE7DA00AF2C2C /* FontCache.cpp */,
+				8E4A85361E1D1AA100F53B0F /* GridPosition.cpp */,
 				83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */,
+				7A909A731D877475007E10F8 /* IntPoint.cpp */,
+				7A909A741D877475007E10F8 /* IntRect.cpp */,
+				7A909A751D877475007E10F8 /* IntSize.cpp */,
 				14464012167A8305000BD218 /* LayoutUnit.cpp */,
+				3162AE9A1E6F2F8F000E4DBC /* mac */,
 				CD225C071C45A69200140761 /* ParsedContentRange.cpp */,
 				CDCFA7A91E45122F00C2433D /* SampleMap.cpp */,
 				CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */,
@@ -1696,8 +1709,6 @@
 				440A1D3814A0103A008A66F2 /* URL.cpp */,
 				5C6E65411D5CEF8500F7862E /* URLParser.cpp */,
 				9C64DC311D76198A004B598E /* YouTubePluginReplacement.cpp */,
-				1C9EB8401E380DA1005C6442 /* ComplexTextController.cpp */,
-				1CAD1F851E5CE7DA00AF2C2C /* FontCache.cpp */,
 			);
 			path = WebCore;
 			sourceTree = "<group>";
@@ -2768,6 +2779,7 @@
 				2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */,
 				7CCE7F071A411AE600447C4C /* PageLoadBasic.cpp in Sources */,
 				7CCE7F081A411AE600447C4C /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */,
+				3162AE9C1E6F2FF5000E4DBC /* GPUDevice.mm in Sources */,
 				7CCE7EC71A411A7E00447C4C /* PageVisibilityStateWithWindowChanges.mm in Sources */,
 				7CCE7F091A411AE600447C4C /* ParentFrame.cpp in Sources */,
 				AD57AC211DA7465B00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm (0 => 213541)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm	2017-03-07 22:23:33 UTC (rev 213541)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#ifdef ENABLE_WEBGPU
+
+#include "config.h"
+#import "Test.h"
+#import <Metal/Metal.h>
+#import <WebCore/GPUDevice.h>
+
+using namespace WebCore;
+
+namespace TestWebKitAPI {
+
+TEST(GPU, Basic)
+{
+    auto device = GPUDevice::create();
+    EXPECT_NOT_NULL(device->layer());
+    EXPECT_NOT_NULL(device->platformLayer());
+
+    id<MTLDevice> mtlDevice = (id<MTLDevice>)device->platformDevice();
+    EXPECT_NOT_NULL(mtlDevice);
+
+    NSString *deviceName = mtlDevice.name;
+    EXPECT_GT(deviceName.length, static_cast<unsigned long>(0));
+}
+
+} // namespace TestWebKitAPI
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to