From 67230ec4999e722c65a77169fc3ac902729f1ce0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 9 Jun 2019 04:32:32 +0900 Subject: [PATCH] graphicsdriver/metal/mtl: Remove CopyAllDevices CopyAllDevices is not used at Ebiten, and not defined on iOS. --- .../graphicsdriver/metal/mtl/example_test.go | 3 --- internal/graphicsdriver/metal/mtl/mtl.go | 19 ------------------- internal/graphicsdriver/metal/mtl/mtl.m | 16 ---------------- 3 files changed, 38 deletions(-) diff --git a/internal/graphicsdriver/metal/mtl/example_test.go b/internal/graphicsdriver/metal/mtl/example_test.go index b986bad99..e64fba583 100644 --- a/internal/graphicsdriver/metal/mtl/example_test.go +++ b/internal/graphicsdriver/metal/mtl/example_test.go @@ -31,9 +31,6 @@ import ( ) func Example_listDevices() { - allDevices := mtl.CopyAllDevices() - printJSON("all Metal devices in the system = ", allDevices) - device, err := mtl.CreateSystemDefaultDevice() if err != nil { log.Fatalln(err) diff --git a/internal/graphicsdriver/metal/mtl/mtl.go b/internal/graphicsdriver/metal/mtl/mtl.go index 8139ff855..a0307ddd0 100644 --- a/internal/graphicsdriver/metal/mtl/mtl.go +++ b/internal/graphicsdriver/metal/mtl/mtl.go @@ -403,25 +403,6 @@ func CreateSystemDefaultDevice() (Device, error) { }, 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 pointer. func (d Device) Device() unsafe.Pointer { return d.device } diff --git a/internal/graphicsdriver/metal/mtl/mtl.m b/internal/graphicsdriver/metal/mtl/mtl.m index a5c72d1cd..49b9c3996 100644 --- a/internal/graphicsdriver/metal/mtl/mtl.m +++ b/internal/graphicsdriver/metal/mtl/mtl.m @@ -34,22 +34,6 @@ struct Device CreateSystemDefaultDevice() { return d; } -// Caller must call free(d.devices). -struct Devices CopyAllDevices() { - NSArray> *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) { return [(id)device supportsFeatureSet:featureSet]; }