Last active
June 8, 2022 17:35
-
-
Save malfet/d8f01d9ac8d2e1268569c4daebd87de6 to your computer and use it in GitHub Desktop.
ObjC script to query available metal devices
This file contains 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 me as | |
// clang++ query_metal_devices.mm -framework Metal -framework Foundation | |
#include <Metal/Metal.h> | |
int main() { | |
@autoreleasepool { | |
NSArray* devices = [MTLCopyAllDevices() autorelease]; | |
NSLog(@"Metal device count %lu", devices.count); | |
for (unsigned long i = 0 ; i < devices.count ; i++) { | |
id<MTLDevice> device = devices[i]; | |
NSLog(@"Found device %@ isLowPower %s", device.name, device.isLowPower ? "true" : "false"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment