mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphicsdriver/metal/ca: Add check by respondsToSelector (#767)
This commit is contained in:
parent
a0a17330ee
commit
6350cb6bfd
@ -48,8 +48,11 @@ const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer,
|
||||
uint_t maximumDrawableCount) {
|
||||
if (@available(macOS 10.13.2, *)) {
|
||||
@try {
|
||||
((CAMetalLayer *)metalLayer).maximumDrawableCount =
|
||||
(NSUInteger)maximumDrawableCount;
|
||||
if ([(CAMetalLayer *)metalLayer
|
||||
respondsToSelector:@selector(maximumDrawableCount)]) {
|
||||
((CAMetalLayer *)metalLayer).maximumDrawableCount =
|
||||
(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).displaySyncEnabled = displaySyncEnabled;
|
||||
if ([(CAMetalLayer *)metalLayer
|
||||
respondsToSelector:@selector(displaySyncEnabled)]) {
|
||||
((CAMetalLayer *)metalLayer).displaySyncEnabled = displaySyncEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user