Skip to main content

Device

Struct Device 

Source
pub struct Device(/* private fields */);

Implementations§

Source§

impl Device

Source

pub fn retained(&self) -> R<Self>

Source§

impl Device

Source

pub fn sys_default() -> Option<R<Device>>

use cidre::mtl;

let device = mtl::Device::sys_default().unwrap();
Source

pub fn name_ar(&self) -> Rar<String>

Source

pub fn name(&self) -> R<String>

Source

pub fn registry_id(&self) -> u64

Source

pub fn sample_timestamps(&self, cpu_ts: &mut Timestamp, gpu_ts: &mut Timestamp)

Source

pub fn max_threads_per_threadgroup(&self) -> Size

Source

pub fn has_unified_memory(&self) -> bool

Source

pub fn read_write_texture_support(&self) -> ReadWriteTextureTier

Source

pub fn argument_bufs_support(&self) -> ArgBufsTier

Source

pub fn new_cmd_queue(&self) -> Option<R<CmdQueue>>

Source

pub fn new_cmd_queue_max_cmd_buf_count( &self, max_cmd_buf_count: usize, ) -> Option<R<CmdQueue>>

Source

pub fn new_texture(&self, descriptor: &TextureDesc) -> Option<R<Texture>>

Source

pub fn new_texture_with_surf( &self, descriptor: &TextureDesc, surf: &Surf, plane: usize, ) -> Option<R<Texture>>

Source

pub fn new_default_lib(&self) -> Option<R<Lib>>

Source

pub unsafe fn new_default_lib_with_bundle_err<'ear>( &self, bundle: &Bundle, err: *mut Option<&'ear Error>, ) -> Option<R<Lib>>

Source

pub fn new_default_lib_with_bundle<'ear>( &self, bundle: &Bundle, ) -> Result<'ear, R<Lib>>

Source

pub unsafe fn new_lib_with_src_err<'ear>( &self, src: &String, opts: Option<&CompileOpts>, err: *mut Option<&'ear Error>, ) -> Option<R<Lib>>

Source

pub fn new_lib_with_src_blocking<'ear>( &self, src: &String, opts: Option<&CompileOpts>, ) -> Result<'ear, R<Lib>>

Source

pub async fn new_lib_with_src_opts( &self, src: &String, opts: Option<&CompileOpts>, ) -> Result<R<Lib>, R<Error>>

Source

pub fn new_lib_with_src_ch( &self, src: &String, ops: Option<&CompileOpts>, ch: &mut ResultCh<Lib>, )

Source

pub unsafe fn new_lib_with_stitched_desc_err<'ear>( &self, desc: FnStitchedLibDesc, error: *mut Option<&'ear Error>, ) -> Option<R<Lib>>

Source

pub fn new_lib_with_stitched_desc_blocking<'ear>( &self, desc: FnStitchedLibDesc, ) -> Result<'ear, R<Lib>>

Source

pub fn new_lib_with_stitched_desc_ch( &self, desc: FnStitchedLibDesc, ch: &mut ResultCh<Lib>, )

Source

pub async fn new_lib_with_stitched_desc( &self, desc: FnStitchedLibDesc, ) -> Result<R<Lib>, R<Error>>

Source

pub unsafe fn new_compute_ps_with_fn_err<'ear>( &self, function: &Fn, err: *mut Option<&'ear Error>, ) -> Option<R<ComputePipelineState>>

Source

pub unsafe fn new_render_ps_err<'ear>( &self, desc: &RenderPipelineDesc, err: *mut Option<&'ear Error>, ) -> Option<R<RenderPipelineState>>

Source

pub fn new_render_ps<'ear>( &self, desc: &RenderPipelineDesc, ) -> Result<'ear, R<RenderPipelineState>>

Source

pub fn new_compute_ps_with_fn<'ear>( &self, function: &Fn, ) -> Result<'ear, R<ComputePipelineState>>

Source

pub unsafe fn new_compute_ps_err<'ear, 'rar>( &self, desc: &ComputePipelineDesc, opts: PipelineOpt, reflection: *mut Option<&'rar ComputePipelineReflection>, err: *mut Option<&'ear Error>, ) -> Option<R<ComputePipelineState>>

Source

pub fn new_compute_ps<'ear>( &self, desc: &ComputePipelineDesc, opts: PipelineOpt, ) -> Result<'ear, R<ComputePipelineState>>

Source

pub unsafe fn new_tile_render_ps_err<'ear, 'rar>( &self, desc: &TileRenderPipelineDesc, opts: PipelineOpt, reflection: *mut Option<&'rar RenderPipelineReflection>, err: *mut Option<&'ear Error>, ) -> Option<R<RenderPipelineState>>

Source

pub fn new_tile_render_ps<'ear>( &self, desc: &TileRenderPipelineDesc, opts: PipelineOpt, ) -> Result<'ear, R<RenderPipelineState>>

Source

pub fn new_buf(&self, len: usize, options: ResOpts) -> Option<R<Buf>>

Source

pub fn new_buf_of<T: Sized>(&self, len: usize, opts: ResOpts) -> Option<R<Buf>>

Source

pub fn new_buf_with_bytes( &self, bytes: *const u8, len: usize, opts: ResOpts, ) -> Option<R<Buf>>

Source

pub fn new_buf_with_slice<T: Sized>( &self, slice: &[T], opts: ResOpts, ) -> Option<R<Buf>>

Source

pub fn new_buf_from_vec<T: Sized>( &self, vec: Vec<T>, opts: ResOpts, ) -> Option<R<Buf>>

Source

pub fn new_depth_stencil_state( &self, descr: &DepthStencilDesc, ) -> Option<R<DepthStencilState>>

Source

pub fn new_fence(&self) -> Option<R<Fence>>

Source

pub fn new_indirect_cmd_buf( &self, desc: &IndirectCmdBufDesc, max_command_count: usize, options: ResOpts, ) -> Option<R<IndirectCmdBuf>>

Creates a new indirect command buffer with the given descriptor and count.

Source

pub fn sel_new_indirect_cmd_buf() -> &'static Sel

@selector(newIndirectCommandBufferWithDescriptor:maxCommandCount:options:) but dynamic use this function to check if object responds to selector

Source

pub fn new_event(&self) -> Option<R<Event>>

New single-device non-shareable Metal event object.

Source

pub fn new_shared_event(&self) -> Option<R<SharedEvent>>

New shareable multi-device event.

Source

pub fn max_buf_len(&self) -> usize

Source

pub fn heap_texture_size_and_align(&self, descriptor: &TextureDesc) -> SizeAlign

Returns the size and alignment, in bytes, of a texture if you create it from a heap.

Source

pub fn heap_buf_size_and_align(&self, len: usize, opts: ResOpts) -> SizeAlign

Returns the size and alignment, in bytes, of a buffer if you create it from a heap.

Source

pub fn new_heap_desc(&self, descriptor: &HeapDesc) -> Option<R<Heap>>

Source

pub fn max_threadgroup_memory_len(&self) -> usize

The maximum threadgroup memory available to a compute kernel, in bytes.

Source

pub fn max_argument_buf_sampler_count(&self) -> usize

The maximum number of unique argument buffer samplers per app.

This limit is only applicable to samplers that have their supportArgumentBuffers property set to true. A mtl::SamplerState object is considered unique if the configuration of its originating mtl::SamplerDescriptor properties is unique. For example, two samplers with equal min_filter values but different mag_filter values are considered unique.

Source

pub fn supports_raytracing(&self) -> bool

Query device support for using ray tracing from compute pipelines.

Source

pub fn supports_fn_pointers(&self) -> bool

Query device support for using function pointers from compute pipelines.

Source

pub fn sel_supports_fn_pointers() -> &'static Sel

@selector(supportsFunctionPointers) but dynamic use this function to check if object responds to selector

Source

pub fn supports_fn_pointers_from_render(&self) -> bool

Query device support for using function pointers from render pipeline stages.

Source

pub fn supports_raytracing_from_render(&self) -> bool

Query device support for using ray tracing from render pipeline stages.

Source

pub fn supports_primitive_motion_blur(&self) -> bool

Query device support for using ray tracing primitive motion blur.

Source

pub fn sel_supports_primitive_motion_blur() -> &'static Sel

@selector(supportsPrimitiveMotionBlur) but dynamic use this function to check if object responds to selector

Source

pub fn max_concurrent_compilation_task_count(&self) -> usize

Source

pub fn sel_max_concurrent_compilation_task_count() -> &'static Sel

@selector(maximumConcurrentCompilationTaskCount) but dynamic use this function to check if object responds to selector

Source

pub fn supports_family(&self, val: GpuFamily) -> bool

Source

pub fn sel_supports_family() -> &'static Sel

@selector(supportsFamily:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn min_linear_texture_alignment_for_pixel_format_throws( &self, format: PixelFormat, ) -> usize

Returns the minimum alignment required for offset and rowBytes when creating a linear texture. An error is thrown for queries with invalid pixel formats (depth, stencil, or compressed formats).

Source

pub fn min_linear_texture_alignment_for_pixel_format<'ear>( &self, format: PixelFormat, ) -> ExResult<'ear, usize>

Source

pub fn min_texture_buffer_alignment_for_pixel_format( &self, format: PixelFormat, ) -> usize

Source

pub unsafe fn new_residency_set_err<'ear>( &self, desc: &ResidencySetDesc, err: *mut Option<&'ear Error>, ) -> Option<R<ResidencySet>>

Source

pub fn sel_new_residency_set_err() -> &'static Sel

@selector(newResidencySetWithDescriptor:error:) but dynamic use this function to check if object responds to selector

Source

pub fn new_residency_set<'ear>( &self, desc: &ResidencySetDesc, ) -> Result<'ear, R<ResidencySet>>

Creates a new residency set with a descriptor.

§Availability

macos_15_0, ios_18_0, tvos_18_0, visionos_2_0, maccatalyst_18_0

Source

pub fn tensor_size_align_with_desc(&self, desc: &TensorDesc) -> SizeAlign

Determines the size and alignment required to hold the data of a tensor you create with a descriptor in a buffer.

Source

pub fn sel_new_tensor_err() -> &'static Sel

@selector(newTensorWithDescriptor:error:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_tensor_err<'ear>( &self, desc: &TensorDesc, err: *mut Option<&'ear Error>, ) -> Option<R<Tensor>>

Source

pub unsafe fn new_tensor<'ear>( &self, desc: &TensorDesc, ) -> Result<'ear, R<Tensor>>

§Availability

Not macos_26_0, ios_26_0, tvos_26_0, visionos_26_0, maccatalyst_26_0

Source

pub fn sel_fn_handle() -> &'static Sel

@selector(functionHandleWithFunction:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn fn_handle_ar(&self, f: &Fn) -> Option<Rar<AnyFnHandle>>

Source

pub unsafe fn fn_handle(&self, f: &Fn) -> Option<R<AnyFnHandle>>

Check availability with selector1 Self::sel_fn_handle()

Source

pub fn sel_new_cmd_allocator() -> &'static Sel

@selector(newCommandAllocator) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_cmd_allocator(&self) -> Option<R<CmdAllocator>>

Source

pub fn sel_new_cmd_allocator_desc_err() -> &'static Sel

@selector(newCommandAllocatorWithDescriptor:error:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_cmd_allocator_desc_err<'ear>( &self, desc: &CmdAllocator, err: *mut Option<&'ear Error>, ) -> Option<R<CmdAllocator>>

Source

pub unsafe fn new_cmd_allocator_desc<'ear>( &self, desc: &CmdAllocator, ) -> Result<'ear, R<CmdAllocator>>

§Availability

Not macos_26_0, ios_26_0, tvos_26_0, visionos_26_0, maccatalyst_26_0

Source

pub fn sel_new_mtl4_cmd_queue() -> &'static Sel

@selector(newMTL4CommandQueue) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_mtl4_cmd_queue(&self) -> Option<R<CmdQueue>>

Source

pub fn sel_new_mtl4_cmd_queue_desc_err() -> &'static Sel

@selector(newMTL4CommandQueueWithDescriptor:error:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_mtl4_cmd_queue_desc_err<'ear>( &self, desc: &CmdQueueDesc, err: *mut Option<&'ear Error>, ) -> Option<R<CmdQueue>>

Source

pub unsafe fn new_mtl4_cmd_queue_desc<'ear>( &self, desc: &CmdQueueDesc, ) -> Result<'ear, R<CmdQueue>>

§Availability

Not macos_26_0, ios_26_0, tvos_26_0, visionos_26_0, maccatalyst_26_0

Source

pub fn sel_new_cmd_buf() -> &'static Sel

@selector(newCommandBuffer) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_cmd_buf(&self) -> Option<R<CmdBuf>>

Source

pub fn sel_new_arg_table_err() -> &'static Sel

@selector(newArgumentTableWithDescriptor:error:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_arg_table_err<'ear>( &self, desc: &ArgTableDesc, err: *mut Option<&'ear Error>, ) -> Option<R<ArgTable>>

Source

pub unsafe fn new_arg_table<'ear>( &self, desc: &ArgTableDesc, ) -> Result<'ear, R<ArgTable>>

§Availability

Not macos_26_0, ios_26_0, tvos_26_0, visionos_26_0, maccatalyst_26_0

Source

pub fn sel_new_compiler_err() -> &'static Sel

@selector(newCompilerWithDescriptor:error:) but dynamic use this function to check if object responds to selector

Source

pub unsafe fn new_compiler_err<'ear>( &self, desc: &CompilerDesc, err: *mut Option<&'ear Error>, ) -> Option<R<Compiler>>

Source

pub unsafe fn new_compiler<'ear>( &self, desc: &CompilerDesc, ) -> Result<'ear, R<Compiler>>

§Availability

Not macos_26_0, ios_26_0, tvos_26_0, visionos_26_0, maccatalyst_26_0

Source

pub fn all() -> R<Array<Device>>

Returns an array of all the Metal device instances in the system.

§Availability

macos_10_11, ios_18_0, tvos_18_0, visionos_2_0, maccatalyst_13_0

Methods from Deref<Target = Id>§

Source

pub unsafe fn value_for_key_throws_ar(&self, key: &String) -> Option<Rar<Self>>

Source

pub unsafe fn value_for_key_throws(&self, key: &String) -> Option<R<Self>>

Source

pub fn value_for_key<'ear>( &self, key: &String, ) -> ExResult<'ear, Option<R<Self>>>

Source

pub unsafe fn set_value_for_key_throws( &mut self, val: Option<&Self>, key: &String, )

Source

pub fn set_value_for_key<'ear>( &mut self, val: Option<&Self>, key: &String, ) -> ExResult<'ear>

Source

pub unsafe fn value_for_key_path_throws_ar( &self, key_path: &String, ) -> Option<Rar<Self>>

Source

pub unsafe fn value_for_key_path_throws( &self, key_path: &String, ) -> Option<R<Self>>

Source

pub fn value_for_key_path<'ear>( &self, key_path: &String, ) -> ExResult<'ear, Option<R<Self>>>

Source

pub unsafe fn set_value_for_key_path_throws( &mut self, val: Option<&Self>, key_path: &String, )

Source

pub fn set_value_for_key_path<'ear>( &mut self, val: Option<&Self>, key_path: &String, ) -> ExResult<'ear>

Source

pub fn as_type_ref(&self) -> &Type

Source

pub fn as_id_ref(&self) -> &Self

Source

pub fn is_equal(&self, other: &Self) -> bool

Source

pub fn hash(&self) -> UInteger

Source

pub fn as_ptr(&self) -> *const Self

Trait Implementations§

Source§

impl AsRef<Id> for Device

Source§

fn as_ref(&self) -> &Id

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Device

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Device

Source§

type Target = Id

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Device

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Obj for Device

Source§

unsafe fn retain(id: &Self) -> R<Self>

Source§

unsafe fn release(id: &mut Self)

Source§

fn desc_ar(&self) -> Rar<String>

Source§

fn desc(&self) -> R<String>

Source§

fn debug_desc_ar(&self) -> Rar<String>

Source§

fn debug_desc(&self) -> R<String>

Source§

fn responds_to_sel(&self, sel: &Sel) -> bool

Source§

fn class(&self) -> &Class<Self>

Source§

fn is_kind_of_class<T: Obj>(&self, cls: &Class<T>) -> bool

Source§

fn try_cast<T: Obj>(&self, cls: &Class<T>) -> Option<&T>

Source§

fn try_cast_mut<T: Obj>(&mut self, cls: &Class<T>) -> Option<&mut T>

Source§

fn is_member_of_class<T: Obj>(&self, cls: &Class<T>) -> bool

Source§

fn is_tagged_ptr(&self) -> bool

Source§

fn as_id_ref(&self) -> &Id

Source§

impl PartialEq for Device

Source§

fn eq(&self, other: &Device) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Retained<Device>> for Device

Source§

fn eq(&self, other: &R<Device>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Device

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Release for T
where T: Obj,

Source§

unsafe fn release(&mut self)

Source§

impl<T> Retain for T
where T: Obj,

Source§

fn retained(&self) -> Retained<T>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.