graphicsdriver/metal: Use selector again to access properties (#767)

This commit is contained in:
Hajime Hoshi 2019-01-02 01:09:12 +09:00
parent 6350cb6bfd
commit ac6ad717b7

View File

@ -48,11 +48,8 @@ const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer,
uint_t maximumDrawableCount) { uint_t maximumDrawableCount) {
if (@available(macOS 10.13.2, *)) { if (@available(macOS 10.13.2, *)) {
@try { @try {
if ([(CAMetalLayer *)metalLayer [((CAMetalLayer *)metalLayer)
respondsToSelector:@selector(maximumDrawableCount)]) { setMaximumDrawableCount:(NSUInteger)maximumDrawableCount];
((CAMetalLayer *)metalLayer).maximumDrawableCount =
(NSUInteger)maximumDrawableCount;
}
} @catch (NSException *exception) { } @catch (NSException *exception) {
return exception.reason.UTF8String; return exception.reason.UTF8String;
} }
@ -63,10 +60,7 @@ const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer,
void MetalLayer_SetDisplaySyncEnabled(void *metalLayer, void MetalLayer_SetDisplaySyncEnabled(void *metalLayer,
BOOL displaySyncEnabled) { BOOL displaySyncEnabled) {
if (@available(macOS 10.13, *)) { if (@available(macOS 10.13, *)) {
if ([(CAMetalLayer *)metalLayer [((CAMetalLayer *)metalLayer) setDisplaySyncEnabled:displaySyncEnabled];
respondsToSelector:@selector(displaySyncEnabled)]) {
((CAMetalLayer *)metalLayer).displaySyncEnabled = displaySyncEnabled;
}
} }
} }