From 1233b66c90d45c3c2b16a6d0635183201893dffc Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Sat, 18 Jul 2020 00:43:17 +0000 Subject: [PATCH] Guard [MTLDevice recommendedMaxWorkingSetSize] only on MacOS Bug: none Change-Id: Id5d23151953dfc5401776180b42d921adc22833b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25161 Commit-Queue: Austin Eng Reviewed-by: Kai Ninomiya --- src/dawn_native/metal/BufferMTL.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dawn_native/metal/BufferMTL.mm b/src/dawn_native/metal/BufferMTL.mm index cfc651535a..e9f131ec3f 100644 --- a/src/dawn_native/metal/BufferMTL.mm +++ b/src/dawn_native/metal/BufferMTL.mm @@ -68,6 +68,7 @@ namespace dawn_native { namespace metal { if (currentSize > maxBufferSize) { return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large"); } +#if defined(DAWN_PLATFORM_MACOS) } else if (@available(macOS 10.12, *)) { // |maxBufferLength| isn't always available on older systems. If available, use // |recommendedMaxWorkingSetSize| instead. We can probably allocate more than this, @@ -77,6 +78,7 @@ namespace dawn_native { namespace metal { if (currentSize > maxWorkingSetSize) { return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large"); } +#endif } else if (currentSize > kMaxBufferSizeFallback) { return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large"); }