@@ -25,43 +25,45 @@ func Example_listDevices() {
}
printJSON("preferred system default Metal device = ", device)
fmt.Println("device supports the macOS GPU family 1, version 1 feature set:", device.SupportsFeatureSet(mtl.MacOSGPUFamily1V1))
fmt.Println("device supports the macOS GPU family 1, version 2 feature set:", device.SupportsFeatureSet(mtl.MacOSGPUFamily1V2))
fmt.Println("device supports the macOS read-write texture, tier 2 feature set:", device.SupportsFeatureSet(mtl.MacOSReadWriteTextureTier2))
fmt.Println("device supports the macOS GPU family 1, version 3 feature set:", device.SupportsFeatureSet(mtl.MacOSGPUFamily1V3))
fmt.Println("device supports the macOS GPU family 1, version 4 feature set:", device.SupportsFeatureSet(mtl.MacOSGPUFamily1V4))
fmt.Println("device supports the macOS GPU family 2, version 1 feature set:", device.SupportsFeatureSet(mtl.MacOSGPUFamily2V1))
// Sample output:
// all Metal devices in the system = [
// {
// "Headless": false,
// "LowPower": true,
// "Removable": false,
// "RegistryID": 4294968304,
// "RegistryID": 4294968287,
// "Name": "Intel Iris Pro Graphics"
// },
// {
// "Headless": false,
// "LowPower": false,
// "Removable": false,
// "RegistryID": 4294968344,
// "RegistryID": 4294968322,
// "Name": "AMD Radeon R9 M370X"
// }
// ]
// preferred system default Metal device = {
// "Headless": false,
// "LowPower": false,
// "Removable": false,
// "RegistryID": 4294968344,
// "RegistryID": 4294968322,
// "Name": "AMD Radeon R9 M370X"
// }
// device supports the macOS GPU family 1, version 1 feature set: true
// device supports the macOS GPU family 1, version 2 feature set: true
// device supports the macOS read-write texture, tier 2 feature set: true
// device supports the macOS GPU family 1, version 3 feature set: true
// device supports the macOS GPU family 1, version 4 feature set: false
// device supports the macOS GPU family 2, version 1 feature set: false
// device supports the macOS GPU family 1, version 4 feature set: true
// device supports the macOS GPU family 2, version 1 feature set: true
}
// printJSON prints label, then v as JSON encoded with indent to stdout. It panics on any error.
// It's meant to be used by examples to print the output.
func printJSON(label string, v interface{}) {