Documentation
¶
Overview ¶
Package metal provides zero-CGo bindings to Apple's Metal and Metal Performance Shaders (MPS) frameworks via purego/dlopen. It is only available on darwin (macOS/iOS).
Index ¶
- func Available() bool
- func GetDeviceCount() (int, error)
- type BufferBinding
- type ComputeContext
- type ComputePipeline
- type Context
- func (c *Context) CreateStream() (*Stream, error)
- func (c *Context) Destroy() error
- func (c *Context) Device() uintptr
- func (c *Context) DeviceID() int
- func (c *Context) Free(unsafe.Pointer) error
- func (c *Context) Malloc(int) (unsafe.Pointer, error)
- func (c *Context) Memcpy(_, _ unsafe.Pointer, _ int, _ MemcpyKind) error
- func (c *Context) Queue() uintptr
- type MTLSize
- type MemcpyKind
- type MetalLib
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDeviceCount ¶
GetDeviceCount returns 0 on non-darwin platforms.
Types ¶
type BufferBinding ¶
BufferBinding pairs a Metal buffer handle with an offset.
type ComputeContext ¶
type ComputeContext struct{}
ComputeContext is a stub on non-darwin platforms.
func NewComputeContext ¶
func NewComputeContext(_ *Context) (*ComputeContext, error)
NewComputeContext returns an error on non-darwin platforms.
func (*ComputeContext) Destroy ¶
func (cc *ComputeContext) Destroy()
Destroy is a no-op on non-darwin platforms.
func (*ComputeContext) Dispatch ¶
func (cc *ComputeContext) Dispatch(_ *ComputePipeline, _, _ MTLSize, _ map[int]BufferBinding, _ map[int][]byte, _ ...map[int]int) error
Dispatch returns an error on non-darwin platforms.
func (*ComputeContext) GetPipeline ¶
func (cc *ComputeContext) GetPipeline(_ string) (*ComputePipeline, error)
GetPipeline returns an error on non-darwin platforms.
type ComputePipeline ¶
type ComputePipeline struct{}
ComputePipeline is a stub on non-darwin platforms.
type Context ¶
type Context struct{}
Context is a stub on non-darwin platforms.
func NewContext ¶
NewContext returns an error on non-darwin platforms.
func (*Context) CreateStream ¶
type MemcpyKind ¶
type MemcpyKind int
MemcpyKind specifies the direction of a memory copy.
const ( MemcpyHostToDevice MemcpyKind = iota MemcpyDeviceToHost MemcpyDeviceToDevice )