Skip to main content

Module device

Module device 

Source
Expand description

Metal device interface.

Corresponds to Metal/MTLDevice.hpp.

The Device represents a GPU that can execute Metal commands. Use the system_default function to get the default GPU, or copy_all_devices (macOS only) to enumerate all available GPUs.

§Example

use mtl_gpu::device;

// Get the default GPU
let device = device::system_default().expect("no Metal device");
println!("Using GPU: {}", device.name());

Structs§

Architecture
GPU architecture information.
Device
A Metal device representing a GPU.
DeviceObserver
Device observer handle.

Functions§

copy_all_devices
Copy all available Metal devices (macOS only).
copy_all_devices_with_observer
Copy all devices with an observer for hot-plug notifications (macOS only).
remove_device_observer
Remove a device observer (macOS only).
system_default
Create the system default Metal device.

Type Aliases§

Timestamp
Timestamp type for CPU/GPU timestamp queries.