metal

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available returns false on non-darwin platforms.

func GetDeviceCount

func GetDeviceCount() (int, error)

GetDeviceCount returns 0 on non-darwin platforms.

Types

type BufferBinding

type BufferBinding struct {
	Buffer uintptr
	Offset int
}

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

func NewContext(int) (*Context, error)

NewContext returns an error on non-darwin platforms.

func (*Context) CreateStream

func (c *Context) CreateStream() (*Stream, error)

func (*Context) Destroy

func (c *Context) Destroy() error

func (*Context) Device

func (c *Context) Device() uintptr

func (*Context) DeviceID

func (c *Context) DeviceID() int

func (*Context) Free

func (c *Context) Free(unsafe.Pointer) error

func (*Context) Malloc

func (c *Context) Malloc(int) (unsafe.Pointer, error)

func (*Context) Memcpy

func (c *Context) Memcpy(_, _ unsafe.Pointer, _ int, _ MemcpyKind) error

func (*Context) Queue

func (c *Context) Queue() uintptr

type MTLSize

type MTLSize struct {
	Width  uint64
	Height uint64
	Depth  uint64
}

MTLSize represents a Metal size structure.

type MemcpyKind

type MemcpyKind int

MemcpyKind specifies the direction of a memory copy.

const (
	MemcpyHostToDevice MemcpyKind = iota
	MemcpyDeviceToHost
	MemcpyDeviceToDevice
)

type MetalLib

type MetalLib struct{}

MetalLib is a stub on non-darwin platforms.

func Lib

func Lib() *MetalLib

Lib returns nil on non-darwin platforms.

type Stream

type Stream struct{}

Stream is a stub on non-darwin platforms.

func (*Stream) Destroy

func (s *Stream) Destroy() error

func (*Stream) Ptr

func (s *Stream) Ptr() unsafe.Pointer

func (*Stream) Synchronize

func (s *Stream) Synchronize() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL