Created
May 20, 2016 07:08
-
-
Save Keyaku/3d8d493b080a08f21e7122c02ecfd33a to your computer and use it in GitHub Desktop.
Check for Metal capability on your Mac OS X system. 10.11 & above only!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** Compile in terminal with the following line: | |
** clang main.m -framework Foundation -framework Metal -o TestMetal | |
*/ | |
#import <Foundation/Foundation.h> | |
#import <Metal/Metal.h> | |
int main(void) { | |
@autoreleasepool { | |
NSArray<id<MTLDevice>> *devices = MTLCopyAllDevices(); | |
printf("Metal-capable devices: %d\n", (int) devices.count); | |
for (id<MTLDevice> device in devices) { | |
const char *name = device.name.UTF8String; | |
const char *lowpower = device.isLowPower ? "yes" : "no"; | |
const char *headless = device.isHeadless ? "yes" : "no"; | |
printf(" - %s (low power: %s, headless: %s)\n", name, lowpower, headless); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment