pub struct BorrowedAppleMetalDevice<'a> { /* private fields */ }Expand description
An apple_metal::MetalDevice borrowed from an SCK MetalDevice.
Returned by MetalDevice::as_apple_metal. Dereferences to
[apple_metal::MetalDevice] and does not release the underlying
MTLDevice; the borrow keeps the owning MetalDevice alive.
Methods from Deref<Target = MetalDevice>§
pub fn registry_id(&self) -> u64
pub fn registry_id(&self) -> u64
Global IORegistry identifier for the device.
pub fn supports_dynamic_libraries(&self) -> bool
pub fn supports_dynamic_libraries(&self) -> bool
Whether this device supports Metal dynamic libraries.
pub fn supports_render_dynamic_libraries(&self) -> bool
pub fn supports_render_dynamic_libraries(&self) -> bool
Whether this device supports render-stage dynamic libraries.
pub fn supports_raytracing(&self) -> bool
pub fn supports_raytracing(&self) -> bool
Whether this device supports compute ray tracing.
pub fn supports_function_pointers(&self) -> bool
pub fn supports_counter_sampling(&self, sampling_point: usize) -> bool
pub fn supports_counter_sampling(&self, sampling_point: usize) -> bool
Query support for a hardware counter sampling point.
pub fn counter_set_names(&self) -> Vec<String>
pub fn counter_set_names(&self) -> Vec<String>
Return the names of all counter sets exposed by this device.
pub fn new_command_queue_with_max_command_buffer_count(
&self,
max_command_buffer_count: usize,
) -> Option<CommandQueue>
pub fn new_command_queue_with_max_command_buffer_count( &self, max_command_buffer_count: usize, ) -> Option<CommandQueue>
Create a command queue with an explicit maximum in-flight command-buffer count.
pub fn new_command_queue_with_log_state(
&self,
max_command_buffer_count: usize,
log_state: &LogState,
) -> Option<CommandQueue>
pub fn new_command_queue_with_log_state( &self, max_command_buffer_count: usize, log_state: &LogState, ) -> Option<CommandQueue>
Create a command queue that uses log_state for shader logging.
pub fn new_heap(&self, size: usize, storage_mode: usize) -> Option<Heap>
pub fn new_heap(&self, size: usize, storage_mode: usize) -> Option<Heap>
Create a heap with the requested size and storage mode.
Create a new shared event.
pub fn new_dynamic_library_with_source(
&self,
source: &str,
install_name: &str,
) -> Result<DynamicLibrary, String>
pub fn new_dynamic_library_with_source( &self, source: &str, install_name: &str, ) -> Result<DynamicLibrary, String>
Compile source as a Metal dynamic library with the given install_name.
§Errors
Returns Metal’s localized compiler or linker error on failure.
pub fn load_dynamic_library(
&self,
path: &Path,
) -> Result<DynamicLibrary, String>
pub fn load_dynamic_library( &self, path: &Path, ) -> Result<DynamicLibrary, String>
Load a serialized Metal dynamic library from path.
§Errors
Returns Metal’s localized file or linker error on failure.
pub fn new_binary_archive(
&self,
path: Option<&Path>,
) -> Result<BinaryArchive, String>
pub fn new_binary_archive( &self, path: Option<&Path>, ) -> Result<BinaryArchive, String>
Create a binary archive, optionally loading it from path first.
§Errors
Returns Metal’s localized archive creation error on failure.
pub fn new_indirect_command_buffer(
&self,
command_types: usize,
max_command_count: usize,
max_vertex_buffer_bind_count: usize,
max_fragment_buffer_bind_count: usize,
max_kernel_buffer_bind_count: usize,
options: usize,
) -> Option<IndirectCommandBuffer>
pub fn new_indirect_command_buffer( &self, command_types: usize, max_command_count: usize, max_vertex_buffer_bind_count: usize, max_fragment_buffer_bind_count: usize, max_kernel_buffer_bind_count: usize, options: usize, ) -> Option<IndirectCommandBuffer>
Create a new indirect command buffer.
pub fn new_acceleration_structure_with_size(
&self,
size: usize,
) -> Option<AccelerationStructure>
pub fn new_acceleration_structure_with_size( &self, size: usize, ) -> Option<AccelerationStructure>
Allocate storage for a ray-tracing acceleration structure.
pub fn new_counter_sample_buffer(
&self,
counter_set_name: &str,
sample_count: usize,
storage_mode: usize,
label: Option<&str>,
) -> Result<CounterSampleBuffer, String>
pub fn new_counter_sample_buffer( &self, counter_set_name: &str, sample_count: usize, storage_mode: usize, label: Option<&str>, ) -> Result<CounterSampleBuffer, String>
Create a counter sample buffer for the named counter set.
§Errors
Returns Metal’s localized counter-sample-buffer error on failure.
pub fn new_log_state(
&self,
level: usize,
buffer_size: isize,
) -> Result<LogState, String>
pub fn new_log_state( &self, level: usize, buffer_size: isize, ) -> Result<LogState, String>
pub fn new_residency_set(
&self,
label: Option<&str>,
initial_capacity: usize,
) -> Result<ResidencySet, String>
pub fn new_residency_set( &self, label: Option<&str>, initial_capacity: usize, ) -> Result<ResidencySet, String>
pub fn new_argument_encoder_with_descriptors(
&self,
descriptors: &[ArgumentDescriptor],
) -> Result<ArgumentEncoder, ArgumentEncoderError>
pub fn new_argument_encoder_with_descriptors( &self, descriptors: &[ArgumentDescriptor], ) -> Result<ArgumentEncoder, ArgumentEncoderError>
Create an argument encoder from explicit descriptors.
§Errors
Returns descriptor validation failures or native creation failure.
pub fn max_buffer_length(&self) -> usize
pub fn new_tensor( &self, descriptor: &TensorDescriptor, ) -> Result<MetalTensor, TensorError>
pub fn new_spatial_scaler(
&self,
descriptor: &SpatialScalerDescriptor,
) -> Option<SpatialScaler>
pub fn new_spatial_scaler( &self, descriptor: &SpatialScalerDescriptor, ) -> Option<SpatialScaler>
Create a MTLFXSpatialScaler for this device.
pub fn new_temporal_scaler(
&self,
descriptor: &TemporalScalerDescriptor,
) -> Option<TemporalScaler>
pub fn new_temporal_scaler( &self, descriptor: &TemporalScalerDescriptor, ) -> Option<TemporalScaler>
Create a MTLFXTemporalScaler for this device.
pub fn new_compute_pipeline_state_with_descriptor(
&self,
descriptor: &ComputePipelineDescriptor<'_>,
) -> Result<ComputePipelineState, String>
pub fn new_compute_pipeline_state_with_descriptor( &self, descriptor: &ComputePipelineDescriptor<'_>, ) -> Result<ComputePipelineState, String>
Compile a compute pipeline from a public MTLComputePipelineDescriptor wrapper.
§Errors
Returns Metal’s localized pipeline compiler error on failure.
pub fn new_render_pipeline_state_with_descriptor(
&self,
descriptor: &RenderPipelineDescriptor<'_>,
) -> Result<RenderPipelineState, String>
pub fn new_render_pipeline_state_with_descriptor( &self, descriptor: &RenderPipelineDescriptor<'_>, ) -> Result<RenderPipelineState, String>
Compile a render pipeline from a public MTLRenderPipelineDescriptor wrapper.
§Errors
Returns Metal’s localized pipeline compiler error on failure.
pub fn new_tile_render_pipeline_state(
&self,
descriptor: &TileRenderPipelineDescriptor<'_>,
) -> Result<RenderPipelineState, String>
pub fn new_tile_render_pipeline_state( &self, descriptor: &TileRenderPipelineDescriptor<'_>, ) -> Result<RenderPipelineState, String>
Compile a tile render pipeline from a public MTLTileRenderPipelineDescriptor wrapper.
§Errors
Returns Metal’s localized pipeline compiler error on failure.
pub fn new_render_pipeline_state(
&self,
vertex: &MetalFunction,
fragment: &MetalFunction,
color_pixel_format: usize,
sample_count: usize,
) -> Result<RenderPipelineState, String>
pub fn new_render_pipeline_state( &self, vertex: &MetalFunction, fragment: &MetalFunction, color_pixel_format: usize, sample_count: usize, ) -> Result<RenderPipelineState, String>
Compile a render pipeline state from vertex and fragment functions.
§Errors
Returns Metal’s localized pipeline compiler error on failure.
pub fn argument_buffers_support(&self) -> usize
pub fn argument_buffers_support(&self) -> usize
Query the device for the supported argument-buffer tier.
pub fn new_depth_stencil_state(
&self,
descriptor: &DepthStencilDescriptor,
) -> Option<DepthStencilState>
pub fn new_depth_stencil_state( &self, descriptor: &DepthStencilDescriptor, ) -> Option<DepthStencilState>
Compile a MTLDepthStencilState from the given descriptor.
pub fn new_sampler_state(
&self,
descriptor: &SamplerDescriptor,
) -> Option<SamplerState>
pub fn new_sampler_state( &self, descriptor: &SamplerDescriptor, ) -> Option<SamplerState>
Compile a MTLSamplerState from the given descriptor.
pub fn has_unified_memory(&self) -> bool
pub fn has_unified_memory(&self) -> bool
True if the GPU uses unified memory (Apple Silicon).
pub fn recommended_max_working_set_size(&self) -> u64
pub fn recommended_max_working_set_size(&self) -> u64
Recommended maximum working-set size in bytes.
pub fn supports_family(&self, family: i64) -> bool
pub fn supports_family(&self, family: i64) -> bool
True if this device supports the requested feature family —
see [gpu_family].
pub fn new_buffer(&self, length: usize, options: usize) -> Option<MetalBuffer>
pub fn new_buffer(&self, length: usize, options: usize) -> Option<MetalBuffer>
Allocate a GPU-visible buffer of length bytes.
options is an MTLResourceOptions bitmask (see
[resource_options]).
pub fn new_buffer_with_bytes( &self, bytes: &[u8], options: usize, ) -> Option<MetalBuffer>
pub fn new_texture(&self, descriptor: TextureDescriptor) -> Option<MetalTexture>
pub fn new_texture(&self, descriptor: TextureDescriptor) -> Option<MetalTexture>
Allocate a fresh MTLTexture matching descriptor.
pub fn new_command_queue(&self) -> Option<CommandQueue>
pub fn new_command_queue(&self) -> Option<CommandQueue>
Create a new MTLCommandQueue to schedule GPU work.
pub fn new_library_with_source(
&self,
source: &str,
) -> Result<MetalLibrary, String>
pub fn new_library_with_source( &self, source: &str, ) -> Result<MetalLibrary, String>
Compile a Metal Shading Language source string into a runtime
MTLLibrary. On error, returns the localized Metal compiler
diagnostic.
§Errors
Returns the Metal compiler’s localized error string on failure.
pub fn new_compute_pipeline_state(
&self,
function: &MetalFunction,
) -> Result<ComputePipelineState, String>
pub fn new_compute_pipeline_state( &self, function: &MetalFunction, ) -> Result<ComputePipelineState, String>
Compile a kernel into a MTLComputePipelineState ready for
dispatch on a command buffer.
§Errors
Returns the Metal pipeline compiler’s localized error string on failure.