diff options
Diffstat (limited to 'vendor/dmitri.shuralyov.com')
-rw-r--r-- | vendor/dmitri.shuralyov.com/gpu/mtl/mtl.go | 17 | ||||
-rw-r--r-- | vendor/dmitri.shuralyov.com/gpu/mtl/mtl.h | 9 | ||||
-rw-r--r-- | vendor/dmitri.shuralyov.com/gpu/mtl/mtl.m | 3 |
3 files changed, 14 insertions, 15 deletions
diff --git a/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.go b/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.go index 10ec40c..ce28c32 100644 --- a/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.go +++ b/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.go @@ -17,8 +17,9 @@ import ( ) /* -#cgo LDFLAGS: -framework Metal -framework Foundation +#cgo LDFLAGS: -framework Metal -framework CoreGraphics -framework Foundation #include <stdlib.h> +#include <stdbool.h> #include "mtl.h" struct Library Go_Device_MakeLibrary(void * device, _GoString_ source) { return Device_MakeLibrary(device, _GoStringPtr(source), _GoStringLen(source)); @@ -301,9 +302,9 @@ func CreateSystemDefaultDevice() (Device, error) { return Device{ device: d.Device, - Headless: d.Headless != 0, - LowPower: d.LowPower != 0, - Removable: d.Removable != 0, + Headless: bool(d.Headless), + LowPower: bool(d.LowPower), + Removable: bool(d.Removable), RegistryID: uint64(d.RegistryID), Name: C.GoString(d.Name), }, nil @@ -321,9 +322,9 @@ func CopyAllDevices() []Device { 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].Removable = d.Removable != 0 + ds[i].Headless = bool(d.Headless) + ds[i].LowPower = bool(d.LowPower) + ds[i].Removable = bool(d.Removable) ds[i].RegistryID = uint64(d.RegistryID) ds[i].Name = C.GoString(d.Name) } @@ -337,7 +338,7 @@ func (d Device) Device() unsafe.Pointer { return d.device } // // Reference: https://developer.apple.com/documentation/metal/mtldevice/1433418-supportsfeatureset. func (d Device) SupportsFeatureSet(fs FeatureSet) bool { - return C.Device_SupportsFeatureSet(d.device, C.uint16_t(fs)) != 0 + return bool(C.Device_SupportsFeatureSet(d.device, C.uint16_t(fs))) } // MakeCommandQueue creates a serial command submission queue. diff --git a/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.h b/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.h index 24111a9..94d2bbe 100644 --- a/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.h +++ b/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.h @@ -1,6 +1,5 @@ // +build darwin -typedef signed char BOOL; typedef unsigned long uint_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; @@ -8,9 +7,9 @@ typedef unsigned long long uint64_t; struct Device { void * Device; - BOOL Headless; - BOOL LowPower; - BOOL Removable; + bool Headless; + bool LowPower; + bool Removable; uint64_t RegistryID; const char * Name; }; @@ -77,7 +76,7 @@ struct Region { struct Device CreateSystemDefaultDevice(); struct Devices CopyAllDevices(); -BOOL Device_SupportsFeatureSet(void * device, uint16_t featureSet); +bool Device_SupportsFeatureSet(void * device, uint16_t featureSet); void * Device_MakeCommandQueue(void * device); struct Library Device_MakeLibrary(void * device, const char * source, size_t sourceLength); struct RenderPipelineState Device_MakeRenderPipelineState(void * device, struct RenderPipelineDescriptor descriptor); diff --git a/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.m b/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.m index e28eef1..b717b77 100644 --- a/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.m +++ b/vendor/dmitri.shuralyov.com/gpu/mtl/mtl.m @@ -1,7 +1,6 @@ // +build darwin #import <Metal/Metal.h> -#include <stdlib.h> #include "mtl.h" struct Device CreateSystemDefaultDevice() { @@ -40,7 +39,7 @@ struct Devices CopyAllDevices() { return d; } -BOOL Device_SupportsFeatureSet(void * device, uint16_t featureSet) { +bool Device_SupportsFeatureSet(void * device, uint16_t featureSet) { return [(id<MTLDevice>)device supportsFeatureSet:featureSet]; } |