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 <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Austin Eng 2020-07-18 00:43:17 +00:00 committed by Commit Bot service account
parent 4a4c76b8b5
commit 1233b66c90
1 changed files with 2 additions and 0 deletions

View File

@ -68,6 +68,7 @@ namespace dawn_native { namespace metal {
if (currentSize > maxBufferSize) { if (currentSize > maxBufferSize) {
return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large"); return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large");
} }
#if defined(DAWN_PLATFORM_MACOS)
} else if (@available(macOS 10.12, *)) { } else if (@available(macOS 10.12, *)) {
// |maxBufferLength| isn't always available on older systems. If available, use // |maxBufferLength| isn't always available on older systems. If available, use
// |recommendedMaxWorkingSetSize| instead. We can probably allocate more than this, // |recommendedMaxWorkingSetSize| instead. We can probably allocate more than this,
@ -77,6 +78,7 @@ namespace dawn_native { namespace metal {
if (currentSize > maxWorkingSetSize) { if (currentSize > maxWorkingSetSize) {
return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large"); return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large");
} }
#endif
} else if (currentSize > kMaxBufferSizeFallback) { } else if (currentSize > kMaxBufferSizeFallback) {
return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large"); return DAWN_OUT_OF_MEMORY_ERROR("Buffer allocation is too large");
} }