[graphite] Update minimum Metal SDK required

Bug: skia:12466
Change-Id: I97d8743057199abd88948f0804cceb4180ad8b74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455997
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Jim Van Verth 2021-10-05 11:09:01 -04:00 committed by SkCQ
parent efdb1f0a3b
commit 52d1629048
2 changed files with 7 additions and 14 deletions

View File

@ -17,25 +17,22 @@
#include <TargetConditionals.h>
// We're using the MSL version as shorthand for the Metal SDK version here
#if defined(SK_BUILD_FOR_MAC)
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
#define GR_METAL_SDK_VERSION 230
#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
#define GR_METAL_SDK_VERSION 220
#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
#define GR_METAL_SDK_VERSION 210
#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
#define GR_METAL_SDK_VERSION 240
#else
#error Must use at least 10.14 SDK to build Metal backend for MacOS
#error Must use at least 11.00 SDK to build Metal backend for MacOS
#endif
#else
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 || __TV_OS_VERSION_MAX_ALLOWED >= 140000
#define GR_METAL_SDK_VERSION 230
#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 || __TV_OS_VERSION_MAX_ALLOWED >= 130000
#define GR_METAL_SDK_VERSION 220
#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 || __TV_OS_VERSION_MAX_ALLOWED >= 120000
#define GR_METAL_SDK_VERSION 210
#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 || __TV_OS_VERSION_MAX_ALLOWED >= 150000
#define GR_METAL_SDK_VERSION 240
#else
#error Must use at least 12.00 SDK to build Metal backend for iOS
#error Must use at least 14.00 SDK to build Metal backend for iOS
#endif
#endif

View File

@ -11,7 +11,6 @@ namespace skgpu::mtl {
std::unique_ptr<CommandBuffer> CommandBuffer::Make(id<MTLCommandQueue> queue) {
sk_cfp<id<MTLCommandBuffer>> cmdBuffer;
#if GR_METAL_SDK_VERSION >= 230
if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) {
sk_cfp<MTLCommandBufferDescriptor*> desc([[MTLCommandBufferDescriptor alloc] init]);
(*desc).retainedReferences = NO;
@ -21,12 +20,9 @@ std::unique_ptr<CommandBuffer> CommandBuffer::Make(id<MTLCommandQueue> queue) {
// We add a retain here because the command buffer is set to autorelease (not alloc or copy)
cmdBuffer.reset([[queue commandBufferWithDescriptor:desc.get()] retain]);
} else {
#endif
// We add a retain here because the command buffer is set to autorelease (not alloc or copy)
cmdBuffer.reset([[queue commandBufferWithUnretainedReferences] retain]);
#if GR_METAL_SDK_VERSION >= 230
}
#endif
if (cmdBuffer == nil) {
return nullptr;
}