apple-metal-rs
Safe Rust bindings for Apple's Metal
framework on macOS, backed by a Swift bridge in the
screencapturekit-rs style.
apple-metal 0.6.3 now covers:
- device discovery and capability queries
- buffers, textures, texture views, buffer-backed textures, and
IOSurfacezero-copy interop - command queues/buffers plus explicit blit, compute, and render encoders
- MSL compilation, functions, compute/render pipeline state, and descriptor-driven compute/render/tile pipeline creation
- depth/stencil state, sampler state, and descriptor-driven argument encoders
MetalFXspatial / temporal scaler support plus the broaderMetalFXbase / denoised / frame-interpolator symbol families- heaps, events, shared events, dynamic libraries, binary archives, indirect command buffers, acceleration-structure handles, visible / intersection function tables, counter sample buffers, log state, residency sets, and capture scopes
- exhaustive top-level symbol coverage for the audited macOS
Metal.framework+MetalFX.frameworkheaders, including descriptor, reflection, render-pass, resource-state, rasterization-rate, tensor, IO, andMTL4*/MTL4FX*families
See COVERAGE.md for the audited SDK matrix and the note on
which families are exercised by the focused integration tests versus the
broader audited symbol wrappers. MetalPerformanceShaders remains out of
scope for this crate.
Quick start
use ;
let device = system_default.expect;
println!;
let _queue = device.new_command_queue.expect;
let buffer = device
.new_buffer
.expect;
println!;
Zero-copy from IOSurface
With the default iosurface feature:
#
#
#
Examples
01_get_device— create the default Metal device and print basic identity.02_caps_buffer_texture— inspect device capabilities, allocate buffers, and create textures.03_command_buffer_blit— submit a simple blit copy on the GPU.04_compute_shader— compile MSL source and dispatch a compute kernel.05_render_and_explicit_encoders— exercise explicit blit, compute, and render encoders in one program.06_resources_and_archives— use argument encoders, heaps, log state, dynamic libraries, and binary archives.07_advanced_objects— touch shared events, fences, counters, indirect command buffers, residency sets, and capture scopes.
Run one directly with:
Status
- Audited against the active Xcode Metal SDK headers
(
MacOSX26.2.sdk/System/Library/Frameworks/Metal.framework/Headers). COVERAGE.mdtracks implemented, partial, and deferred Metal families.- The crate continues to prefer safe, synchronous handle wrappers over raw Objective-C messaging from Rust.