From 623bfde0079bbcbe64eecca5bffbb4ae68d8c879 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 2 Jan 2019 01:16:54 +0900 Subject: [PATCH] graphicsdriver/metal/ca: Suppress warnings (#767) --- internal/graphicsdriver/metal/ca/ca.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/graphicsdriver/metal/ca/ca.m b/internal/graphicsdriver/metal/ca/ca.m index 9609820f6..4b04a06b4 100644 --- a/internal/graphicsdriver/metal/ca/ca.m +++ b/internal/graphicsdriver/metal/ca/ca.m @@ -48,8 +48,11 @@ const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer, uint_t maximumDrawableCount) { if (@available(macOS 10.13.2, *)) { @try { - [((CAMetalLayer *)metalLayer) - setMaximumDrawableCount:(NSUInteger)maximumDrawableCount]; + if ([(CAMetalLayer *)metalLayer + respondsToSelector:@selector(setMaximumDrawableCount:)]) { + [((CAMetalLayer *)metalLayer) + setMaximumDrawableCount:(NSUInteger)maximumDrawableCount]; + } } @catch (NSException *exception) { return exception.reason.UTF8String; } @@ -60,7 +63,10 @@ const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer, void MetalLayer_SetDisplaySyncEnabled(void *metalLayer, BOOL displaySyncEnabled) { if (@available(macOS 10.13, *)) { - [((CAMetalLayer *)metalLayer) setDisplaySyncEnabled:displaySyncEnabled]; + if ([(CAMetalLayer *)metalLayer + respondsToSelector:@selector(setDisplaySyncEnabled:)]) { + [((CAMetalLayer *)metalLayer) setDisplaySyncEnabled:displaySyncEnabled]; + } } }