Fix Apple SDK availablity check
Change-Id: I02332c8cbddaa30fb74603849fe00c52d9b43b88 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14661 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
2fdc7ab692
commit
7433023fff
|
@ -229,9 +229,10 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
std::vector<std::unique_ptr<AdapterBase>> Backend::DiscoverDefaultAdapters() {
|
||||
std::vector<std::unique_ptr<AdapterBase>> adapters;
|
||||
|
||||
if (@available(macOS 10.11, *)) {
|
||||
BOOL supportedVersion = NO;
|
||||
#if defined(DAWN_PLATFORM_MACOS)
|
||||
if (@available(macOS 10.11, *)) {
|
||||
supportedVersion = YES;
|
||||
NSArray<id<MTLDevice>>* devices = MTLCopyAllDevices();
|
||||
|
||||
for (id<MTLDevice> device in devices) {
|
||||
|
@ -239,14 +240,18 @@ namespace dawn_native { namespace metal {
|
|||
}
|
||||
|
||||
[devices release];
|
||||
}
|
||||
#endif
|
||||
} else if (@available(iOS 8.0, *)) {
|
||||
|
||||
#if defined(DAWN_PLATFORM_IOS)
|
||||
if (@available(iOS 8.0, *)) {
|
||||
supportedVersion = YES;
|
||||
// iOS only has a single device so MTLCopyAllDevices doesn't exist there.
|
||||
adapters.push_back(
|
||||
std::make_unique<Adapter>(GetInstance(), MTLCreateSystemDefaultDevice()));
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (!supportedVersion) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
return adapters;
|
||||
|
|
Loading…
Reference in New Issue