1 // 2 // Copyright 2019 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // apple_platform_utils.h: Common utilities for Apple platforms. 8 9 #ifndef COMMON_APPLE_PLATFORM_UTILS_H_ 10 #define COMMON_APPLE_PLATFORM_UTILS_H_ 11 12 #include "common/platform.h" 13 14 #include <string> 15 16 #if defined(__ARM_ARCH) 17 # define ANGLE_APPLE_IS_ARM (__ARM_ARCH != 0) 18 #else 19 # define ANGLE_APPLE_IS_ARM 0 20 #endif 21 22 #define ANGLE_APPLE_OBJC_SCOPE @autoreleasepool 23 24 #if !__has_feature(objc_arc) 25 # define ANGLE_APPLE_AUTORELEASE autorelease 26 # define ANGLE_APPLE_RETAIN retain 27 # define ANGLE_APPLE_RELEASE release 28 #else 29 # define ANGLE_APPLE_AUTORELEASE self 30 # define ANGLE_APPLE_RETAIN self 31 # define ANGLE_APPLE_RELEASE self 32 #endif 33 34 #define ANGLE_APPLE_UNUSED __attribute__((unused)) 35 36 #if __has_warning("-Wdeprecated-declarations") 37 # define ANGLE_APPLE_ALLOW_DEPRECATED_BEGIN \ 38 _Pragma("GCC diagnostic push") \ 39 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 40 #else 41 # define ANGLE_APPLE_ALLOW_DEPRECATED_BEGIN 42 #endif 43 44 #if __has_warning("-Wdeprecated-declarations") 45 # define ANGLE_APPLE_ALLOW_DEPRECATED_END _Pragma("GCC diagnostic pop") 46 #else 47 # define ANGLE_APPLE_ALLOW_DEPRECATED_END 48 #endif 49 50 namespace angle 51 { 52 bool IsMetalRendererAvailable(); 53 54 #if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) 55 bool GetMacosMachineModel(std::string *outMachineModel); 56 bool ParseMacMachineModel(const std::string &identifier, 57 std::string *type, 58 int32_t *major, 59 int32_t *minor); 60 #endif 61 62 } // namespace angle 63 64 #endif 65