iOS code to identify metal support in runtime?

后端 未结 4 1433
迷失自我
迷失自我 2021-02-13 15:51

Usually, I use the below code to identify the iOS version of the device.

if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)

In

4条回答
  •  逝去的感伤
    2021-02-13 16:40

    I think the best way is to try to get one of the metal classes.

    Class metalDeviceClass = NSClassFromString(@"MTLDevice");
    BOOL isMetalAvailable = metalDeviceClass != nil;
    if (isMetalAvailable) {
        NSLog(@"Metal available");
    } else {
        NSLog(@"Metal not available");
    }
    

提交回复
热议问题