Title: [290273] trunk/Source/WebGPU
Revision
290273
Author
mmaxfi...@apple.com
Date
2022-02-21 15:24:21 -0800 (Mon, 21 Feb 2022)

Log Message

[WebGPU] Fix iOS build
https://bugs.webkit.org/show_bug.cgi?id=237000

The lowPower selector doesn't exist on iOS.

Unreviewed.

* WebGPU/Instance.mm:
(WebGPU::sortedDevices):
(WebGPU::Instance::requestAdapter):

Modified Paths

Diff

Modified: trunk/Source/WebGPU/ChangeLog (290272 => 290273)


--- trunk/Source/WebGPU/ChangeLog	2022-02-21 23:11:34 UTC (rev 290272)
+++ trunk/Source/WebGPU/ChangeLog	2022-02-21 23:24:21 UTC (rev 290273)
@@ -1,5 +1,18 @@
 2022-02-21  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [WebGPU] Fix iOS build
+        https://bugs.webkit.org/show_bug.cgi?id=237000
+
+        The lowPower selector doesn't exist on iOS.
+
+        Unreviewed.
+
+        * WebGPU/Instance.mm:
+        (WebGPU::sortedDevices):
+        (WebGPU::Instance::requestAdapter):
+
+2022-02-21  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [WebGPU] Tracer bullet part 12: Migrate from C function callbacks to blocks
         https://bugs.webkit.org/show_bug.cgi?id=236934
 

Modified: trunk/Source/WebGPU/WebGPU/Instance.mm (290272 => 290273)


--- trunk/Source/WebGPU/WebGPU/Instance.mm	2022-02-21 23:11:34 UTC (rev 290272)
+++ trunk/Source/WebGPU/WebGPU/Instance.mm	2022-02-21 23:24:21 UTC (rev 290273)
@@ -80,6 +80,7 @@
     case WGPUPowerPreference_Undefined:
         return devices;
     case WGPUPowerPreference_LowPower:
+#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
         return [devices sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult (id <MTLDevice> obj1, id <MTLDevice> obj2)
         {
             if (obj1.lowPower == obj2.lowPower)
@@ -88,7 +89,11 @@
                 return NSOrderedAscending;
             return NSOrderedDescending;
         }];
+#else
+        return devices;
+#endif
     case WGPUPowerPreference_HighPerformance:
+#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
         return [devices sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult (id <MTLDevice> obj1, id <MTLDevice> obj2)
         {
             if (obj1.lowPower == obj2.lowPower)
@@ -97,6 +102,9 @@
                 return NSOrderedDescending;
             return NSOrderedAscending;
         }];
+#else
+        return devices;
+#endif
     default:
         return nil;
     }
@@ -107,9 +115,9 @@
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
     NSArray<id <MTLDevice>> *devices = MTLCopyAllDevices();
 #else
-    NSArray<id <MTLDevice>> *devices = [NSArray array];
+    NSMutableArray<id <MTLDevice>> *devices = [NSMutableArray array];
     if (id <MTLDevice> device = MTLCreateSystemDefaultDevice())
-        [devices append:device];
+        [devices addObject:device];
 #endif
 
     // FIXME: Deal with options->compatibleSurface.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to