[ios] Remove mac-specific PopulateMemoryHeapInfo code
This CL assumes hasUnifiedMemory for iOS and adds
mac-specific guards around the alternative path.
credit: cwallez@ for suggesting this approach.
Bug: dawn:2249
Change-Id: Ia345db05312f79fbf5e1d2c82ad7bf8659d61fde
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/163280
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm
index 3485981..6c680a7 100644
--- a/src/dawn/native/metal/BackendMTL.mm
+++ b/src/dawn/native/metal/BackendMTL.mm
@@ -897,8 +897,16 @@
heapInfo[0].properties =
wgpu::HeapProperty::DeviceLocal | wgpu::HeapProperty::HostVisible |
wgpu::HeapProperty::HostCoherent | wgpu::HeapProperty::HostCached;
- heapInfo[0].size = [*mDevice recommendedMaxWorkingSetSize];
+ if (@available(macOS 10.12, iOS 16.0, *)) {
+ heapInfo[0].size = [*mDevice recommendedMaxWorkingSetSize];
+ } else {
+ // Since AdapterPropertiesMemoryHeaps is already gated on the
+ // availability above, we should never reach this case, however
+ // excluding the conditional causes build errors.
+ DAWN_UNREACHABLE();
+ }
} else {
+#if DAWN_PLATFORM_IS(MACOS)
auto* heapInfo = new MemoryHeapInfo[2];
memoryHeapProperties->heapCount = 2;
memoryHeapProperties->heapInfo = heapInfo;
@@ -916,6 +924,9 @@
wgpu::HeapProperty::HostCoherent |
wgpu::HeapProperty::HostCached;
heapInfo[1].size = hostInfo.max_mem;
+#else
+ DAWN_UNREACHABLE();
+#endif
}
}