graphicsdriver/metal/mtl: Remove CopyAllDevices

CopyAllDevices is not used at Ebiten, and not defined on iOS.
This commit is contained in:
Hajime Hoshi 2019-06-09 04:32:32 +09:00
parent 42cf9d1750
commit 67230ec499
3 changed files with 0 additions and 38 deletions

View File

@ -31,9 +31,6 @@ import (
) )
func Example_listDevices() { func Example_listDevices() {
allDevices := mtl.CopyAllDevices()
printJSON("all Metal devices in the system = ", allDevices)
device, err := mtl.CreateSystemDefaultDevice() device, err := mtl.CreateSystemDefaultDevice()
if err != nil { if err != nil {
log.Fatalln(err) log.Fatalln(err)

View File

@ -403,25 +403,6 @@ func CreateSystemDefaultDevice() (Device, error) {
}, nil }, nil
} }
// CopyAllDevices returns all Metal devices in the system.
//
// Reference: https://developer.apple.com/documentation/metal/1433367-mtlcopyalldevices.
func CopyAllDevices() []Device {
d := C.CopyAllDevices()
defer C.free(unsafe.Pointer(d.Devices))
ds := make([]Device, d.Length)
for i := 0; i < len(ds); i++ {
d := (*C.struct_Device)(unsafe.Pointer(uintptr(unsafe.Pointer(d.Devices)) + uintptr(i)*C.sizeof_struct_Device))
ds[i].device = d.Device
ds[i].Headless = d.Headless != 0
ds[i].LowPower = d.LowPower != 0
ds[i].Name = C.GoString(d.Name)
}
return ds
}
// Device returns the underlying id<MTLDevice> pointer. // Device returns the underlying id<MTLDevice> pointer.
func (d Device) Device() unsafe.Pointer { return d.device } func (d Device) Device() unsafe.Pointer { return d.device }

View File

@ -34,22 +34,6 @@ struct Device CreateSystemDefaultDevice() {
return d; return d;
} }
// Caller must call free(d.devices).
struct Devices CopyAllDevices() {
NSArray<id<MTLDevice>> *devices = MTLCopyAllDevices();
struct Devices d;
d.Devices = malloc(devices.count * sizeof(struct Device));
for (int i = 0; i < devices.count; i++) {
d.Devices[i].Device = devices[i];
d.Devices[i].Headless = devices[i].headless;
d.Devices[i].LowPower = devices[i].lowPower;
d.Devices[i].Name = devices[i].name.UTF8String;
}
d.Length = devices.count;
return d;
}
BOOL Device_SupportsFeatureSet(void *device, uint16_t featureSet) { BOOL Device_SupportsFeatureSet(void *device, uint16_t featureSet) {
return [(id<MTLDevice>)device supportsFeatureSet:featureSet]; return [(id<MTLDevice>)device supportsFeatureSet:featureSet];
} }