Title: [213549] trunk
Revision
213549
Author
[email protected]
Date
2017-03-07 16:09:37 -0800 (Tue, 07 Mar 2017)

Log Message

Some platforms won't be able to create a GPUDevice
https://bugs.webkit.org/show_bug.cgi?id=169314
<rdar://problems/30907521>

Reviewed by Jon Lee.

Source/_javascript_Core:

Disable WEB_GPU on the iOS Simulator.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Protect for the case where the hardware doesn't support Metal. And
we might as well disable WebGPU completely in the iOS simulator
for now.

* Configurations/FeatureDefines.xcconfig:
* platform/graphics/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::GPUDevice):
* platform/graphics/gpu/GPUDevice.cpp:
(WebCore::GPUDevice::create):

Source/WebCore/PAL:

Disable WEB_GPU on the iOS Simulator.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

Disable WEB_GPU on the iOS Simulator.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

Disable WEB_GPU on the iOS Simulator.

* Configurations/FeatureDefines.xcconfig:

Tools:

Protect for the case where the hardware doesn't support Metal.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
* TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (213548 => 213549)


--- trunk/Source/_javascript_Core/ChangeLog	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-03-08 00:09:37 UTC (rev 213549)
@@ -1,3 +1,15 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Some platforms won't be able to create a GPUDevice
+        https://bugs.webkit.org/show_bug.cgi?id=169314
+        <rdar://problems/30907521>
+
+        Reviewed by Jon Lee.
+
+        Disable WEB_GPU on the iOS Simulator.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2017-03-06  Saam Barati  <[email protected]>
 
         WebAssembly: Implement the WebAssembly.instantiate API

Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (213548 => 213549)


--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2017-03-08 00:09:37 UTC (rev 213549)
@@ -200,6 +200,7 @@
 ENABLE_WEBGL = ENABLE_WEBGL;
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU[sdk=iphonesimulator*] = ;
 ENABLE_WEB_ANIMATIONS = ENABLE_WEB_ANIMATIONS;
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 ENABLE_WEB_REPLAY = $(ENABLE_WEB_REPLAY_$(PLATFORM_NAME)_$(CONFIGURATION));

Modified: trunk/Source/WebCore/ChangeLog (213548 => 213549)


--- trunk/Source/WebCore/ChangeLog	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebCore/ChangeLog	2017-03-08 00:09:37 UTC (rev 213549)
@@ -1,3 +1,21 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Some platforms won't be able to create a GPUDevice
+        https://bugs.webkit.org/show_bug.cgi?id=169314
+        <rdar://problems/30907521>
+
+        Reviewed by Jon Lee.
+
+        Protect for the case where the hardware doesn't support Metal. And
+        we might as well disable WebGPU completely in the iOS simulator
+        for now.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * platform/graphics/cocoa/GPUDeviceMetal.mm:
+        (WebCore::GPUDevice::GPUDevice):
+        * platform/graphics/gpu/GPUDevice.cpp:
+        (WebCore::GPUDevice::create):
+
 2017-03-07  Maureen Daum  <[email protected]>
 
         Correctly check for an empty database file.

Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (213548 => 213549)


--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2017-03-08 00:09:37 UTC (rev 213549)
@@ -200,6 +200,7 @@
 ENABLE_WEBGL = ENABLE_WEBGL;
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU[sdk=iphonesimulator*] = ;
 ENABLE_WEB_ANIMATIONS = ENABLE_WEB_ANIMATIONS;
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 ENABLE_WEB_REPLAY = $(ENABLE_WEB_REPLAY_$(PLATFORM_NAME)_$(CONFIGURATION));

Modified: trunk/Source/WebCore/PAL/ChangeLog (213548 => 213549)


--- trunk/Source/WebCore/PAL/ChangeLog	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebCore/PAL/ChangeLog	2017-03-08 00:09:37 UTC (rev 213549)
@@ -1,3 +1,15 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Some platforms won't be able to create a GPUDevice
+        https://bugs.webkit.org/show_bug.cgi?id=169314
+        <rdar://problems/30907521>
+
+        Reviewed by Jon Lee.
+
+        Disable WEB_GPU on the iOS Simulator.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2017-03-06  Michael Saboff  <[email protected]>
 
         Take advantage of fast permissions switching of JIT memory for devices that support it

Modified: trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig (213548 => 213549)


--- trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig	2017-03-08 00:09:37 UTC (rev 213549)
@@ -200,6 +200,7 @@
 ENABLE_WEBGL = ENABLE_WEBGL;
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU[sdk=iphonesimulator*] = ;
 ENABLE_WEB_ANIMATIONS = ENABLE_WEB_ANIMATIONS;
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 ENABLE_WEB_REPLAY = $(ENABLE_WEB_REPLAY_$(PLATFORM_NAME)_$(CONFIGURATION));

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GPUDeviceMetal.mm (213548 => 213549)


--- trunk/Source/WebCore/platform/graphics/cocoa/GPUDeviceMetal.mm	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GPUDeviceMetal.mm	2017-03-08 00:09:37 UTC (rev 213549)
@@ -33,7 +33,7 @@
 #import <runtime/ArrayBuffer.h>
 #import <wtf/BlockObjCExceptions.h>
 
-#if ENABLE(WEBGPU) && !PLATFORM(IOS_SIMULATOR)
+#if ENABLE(WEBGPU)
 
 namespace WebCore {
 
@@ -40,13 +40,14 @@
 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");
+        LOG(WebGPU, "GPUDevice::GPUDevice -- could not create the device. This usually means Metal is not available on this hardware.");
         return;
     }
 
+    LOG(WebGPU, "GPUDevice::GPUDevice Metal device is %p", m_device.get());
+
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     m_layer = [[WebGPULayer alloc] initWithGPUDevice:this];
     [m_layer setOpaque:0];

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp (213548 => 213549)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp	2017-03-08 00:09:37 UTC (rev 213549)
@@ -35,6 +35,14 @@
 RefPtr<GPUDevice> GPUDevice::create()
 {
     RefPtr<GPUDevice> device = adoptRef(new GPUDevice());
+
+#if PLATFORM(COCOA)
+    if (!device->platformDevice()) {
+        LOG(WebGPU, "GPUDevice::create() was unable to create the low-level device");
+        return nullptr;
+    }
+#endif
+
     LOG(WebGPU, "GPUDevice::create() device is %p", device.get());
     return device;
 }
@@ -44,7 +52,7 @@
     LOG(WebGPU, "GPUDevice::~GPUDevice()");
 }
 
-#if !PLATFORM(COCOA) || PLATFORM(IOS_SIMULATOR)
+#if !PLATFORM(COCOA)
 
 GPUDevice::GPUDevice()
 {

Modified: trunk/Source/WebKit/mac/ChangeLog (213548 => 213549)


--- trunk/Source/WebKit/mac/ChangeLog	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-03-08 00:09:37 UTC (rev 213549)
@@ -1,3 +1,15 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Some platforms won't be able to create a GPUDevice
+        https://bugs.webkit.org/show_bug.cgi?id=169314
+        <rdar://problems/30907521>
+
+        Reviewed by Jon Lee.
+
+        Disable WEB_GPU on the iOS Simulator.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2017-03-07  Maureen Daum  <[email protected]>
 
         Correctly check for an empty database file.

Modified: trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig (213548 => 213549)


--- trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig	2017-03-08 00:09:37 UTC (rev 213549)
@@ -200,6 +200,7 @@
 ENABLE_WEBGL = ENABLE_WEBGL;
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU[sdk=iphonesimulator*] = ;
 ENABLE_WEB_ANIMATIONS = ENABLE_WEB_ANIMATIONS;
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 ENABLE_WEB_REPLAY = $(ENABLE_WEB_REPLAY_$(PLATFORM_NAME)_$(CONFIGURATION));

Modified: trunk/Source/WebKit2/ChangeLog (213548 => 213549)


--- trunk/Source/WebKit2/ChangeLog	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-08 00:09:37 UTC (rev 213549)
@@ -1,3 +1,15 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Some platforms won't be able to create a GPUDevice
+        https://bugs.webkit.org/show_bug.cgi?id=169314
+        <rdar://problems/30907521>
+
+        Reviewed by Jon Lee.
+
+        Disable WEB_GPU on the iOS Simulator.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2017-03-07  Brent Fulgham  <[email protected]>
 
         [Mac][iOS][WK2] Whitelist sysctl-read

Modified: trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig (213548 => 213549)


--- trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig	2017-03-08 00:09:37 UTC (rev 213549)
@@ -200,6 +200,7 @@
 ENABLE_WEBGL = ENABLE_WEBGL;
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU[sdk=iphonesimulator*] = ;
 ENABLE_WEB_ANIMATIONS = ENABLE_WEB_ANIMATIONS;
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 ENABLE_WEB_REPLAY = $(ENABLE_WEB_REPLAY_$(PLATFORM_NAME)_$(CONFIGURATION));

Modified: trunk/Tools/ChangeLog (213548 => 213549)


--- trunk/Tools/ChangeLog	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Tools/ChangeLog	2017-03-08 00:09:37 UTC (rev 213549)
@@ -1,3 +1,17 @@
+2017-03-07  Dean Jackson  <[email protected]>
+
+        Some platforms won't be able to create a GPUDevice
+        https://bugs.webkit.org/show_bug.cgi?id=169314
+        <rdar://problems/30907521>
+
+        Reviewed by Jon Lee.
+
+        Protect for the case where the hardware doesn't support Metal.
+
+        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
+        * TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm:
+        (TestWebKitAPI::TEST):
+
 2017-03-07  Maureen Daum  <[email protected]>
 
         Correctly check for an empty database file.

Modified: trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig (213548 => 213549)


--- trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2017-03-08 00:09:37 UTC (rev 213549)
@@ -200,6 +200,7 @@
 ENABLE_WEBGL = ENABLE_WEBGL;
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU[sdk=iphonesimulator*] = ;
 ENABLE_WEB_ANIMATIONS = ENABLE_WEB_ANIMATIONS;
 ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
 ENABLE_WEB_REPLAY = $(ENABLE_WEB_REPLAY_$(PLATFORM_NAME)_$(CONFIGURATION));

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm (213548 => 213549)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm	2017-03-07 23:21:49 UTC (rev 213548)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm	2017-03-08 00:09:37 UTC (rev 213549)
@@ -37,6 +37,12 @@
 TEST(GPU, Basic)
 {
     auto device = GPUDevice::create();
+    // Not all hardware supports Metal, so it is possible
+    // that we were unable to create the MTLDevice object.
+    // In that case, the device should be null.
+    if (!device)
+        return;
+
     EXPECT_NOT_NULL(device->layer());
     EXPECT_NOT_NULL(device->platformLayer());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to