Skip to main content

Compiler

Struct Compiler 

Source
pub struct Compiler(/* private fields */);
Expand description

MTL4 shader compiler.

C++ equivalent: MTL4::Compiler

Compiler provides methods for compiling shaders, creating pipelines, and managing binary functions.

Implementations§

Source§

impl Compiler

Source

pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>

Create a Compiler from a raw pointer.

Source

pub fn as_raw(&self) -> *mut c_void

Get the raw pointer.

Source

pub fn device(&self) -> Option<Device>

Get the device.

C++ equivalent: MTL::Device* device() const

Source

pub fn label(&self) -> Option<String>

Get the label.

C++ equivalent: NS::String* label() const

Source

pub fn pipeline_data_set_serializer(&self) -> Option<PipelineDataSetSerializer>

Get the pipeline data set serializer.

C++ equivalent: PipelineDataSetSerializer* pipelineDataSetSerializer() const

Source

pub fn new_library( &self, descriptor: &LibraryDescriptor, ) -> Result<Library, Error>

Create a new library synchronously.

C++ equivalent: MTL::Library* newLibrary(const MTL4::LibraryDescriptor*, NS::Error**)

Source

pub fn new_binary_function( &self, descriptor: &BinaryFunctionDescriptor, options: Option<&CompilerTaskOptions>, ) -> Result<BinaryFunction, Error>

Create a new binary function synchronously.

C++ equivalent: BinaryFunction* newBinaryFunction(..., NS::Error**)

Source

pub fn new_compute_pipeline_state( &self, descriptor: &ComputePipelineDescriptor, options: Option<&CompilerTaskOptions>, ) -> Result<ComputePipelineState, Error>

Create a new compute pipeline state synchronously.

C++ equivalent: MTL::ComputePipelineState* newComputePipelineState(..., NS::Error**)

Source

pub fn new_compute_pipeline_state_with_dynamic_linking( &self, descriptor: &ComputePipelineDescriptor, dynamic_linking: &PipelineStageDynamicLinkingDescriptor, options: Option<&CompilerTaskOptions>, ) -> Result<ComputePipelineState, Error>

Create a new compute pipeline state with dynamic linking synchronously.

C++ equivalent: MTL::ComputePipelineState* newComputePipelineState(..., dynamicLinkingDescriptor, ..., NS::Error**)

Source

pub fn new_render_pipeline_state( &self, descriptor: &PipelineDescriptor, options: Option<&CompilerTaskOptions>, ) -> Result<RenderPipelineState, Error>

Create a new render pipeline state synchronously.

C++ equivalent: MTL::RenderPipelineState* newRenderPipelineState(..., NS::Error**)

Source

pub fn new_render_pipeline_state_with_dynamic_linking( &self, descriptor: &PipelineDescriptor, dynamic_linking: &RenderPipelineDynamicLinkingDescriptor, options: Option<&CompilerTaskOptions>, ) -> Result<RenderPipelineState, Error>

Create a new render pipeline state with dynamic linking synchronously.

C++ equivalent: MTL::RenderPipelineState* newRenderPipelineState(..., dynamicLinkingDescriptor, ..., NS::Error**)

Source

pub fn new_render_pipeline_state_by_specialization( &self, descriptor: &PipelineDescriptor, pipeline: &RenderPipelineState, ) -> Result<RenderPipelineState, Error>

Create a new render pipeline state by specialization.

C++ equivalent: MTL::RenderPipelineState* newRenderPipelineStateBySpecialization(...)

Source

pub fn new_dynamic_library_from_library( &self, library: &Library, ) -> Result<*mut c_void, Error>

Create a new dynamic library from a library.

C++ equivalent: MTL::DynamicLibrary* newDynamicLibrary(const MTL::Library*, NS::Error**)

Source

pub fn new_dynamic_library_from_url( &self, url: *const c_void, ) -> Result<*mut c_void, Error>

Create a new dynamic library from a URL.

C++ equivalent: MTL::DynamicLibrary* newDynamicLibrary(const NS::URL*, NS::Error**)

Source

pub fn new_library_async<F>( &self, descriptor: &LibraryDescriptor, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<Library>, Option<Error>) + Send + 'static,

Create a new library asynchronously with a completion handler.

C++ equivalent: CompilerTask* newLibrary(const LibraryDescriptor*, NewLibraryCompletionHandler)

Source

pub fn new_binary_function_async<F>( &self, descriptor: &BinaryFunctionDescriptor, options: Option<&CompilerTaskOptions>, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<BinaryFunction>, Option<Error>) + Send + 'static,

Create a new binary function asynchronously with a completion handler.

C++ equivalent: CompilerTask* newBinaryFunction(const BinaryFunctionDescriptor*, CompilerTaskOptions*, NewBinaryFunctionCompletionHandler)

Source

pub fn new_compute_pipeline_state_async<F>( &self, descriptor: &ComputePipelineDescriptor, options: Option<&CompilerTaskOptions>, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<ComputePipelineState>, Option<Error>) + Send + 'static,

Create a new compute pipeline state asynchronously with a completion handler.

C++ equivalent: CompilerTask* newComputePipelineState(const ComputePipelineDescriptor*, CompilerTaskOptions*, NewComputePipelineStateCompletionHandler)

Source

pub fn new_render_pipeline_state_async<F>( &self, descriptor: &PipelineDescriptor, options: Option<&CompilerTaskOptions>, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<RenderPipelineState>, Option<Error>) + Send + 'static,

Create a new render pipeline state asynchronously with a completion handler.

C++ equivalent: CompilerTask* newRenderPipelineState(const PipelineDescriptor*, CompilerTaskOptions*, NewRenderPipelineStateCompletionHandler)

Source

pub fn new_render_pipeline_state_by_specialization_async<F>( &self, descriptor: &PipelineDescriptor, pipeline: &RenderPipelineState, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<RenderPipelineState>, Option<Error>) + Send + 'static,

Create a new render pipeline state by specialization asynchronously.

C++ equivalent: CompilerTask* newRenderPipelineStateBySpecialization(..., NewRenderPipelineStateCompletionHandler)

Source

pub fn new_dynamic_library_from_library_async<F>( &self, library: &Library, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<DynamicLibrary>, Option<Error>) + Send + 'static,

Create a new dynamic library from a library asynchronously.

C++ equivalent: CompilerTask* newDynamicLibrary(const Library*, NewDynamicLibraryCompletionHandler)

Source

pub unsafe fn new_dynamic_library_from_url_async<F>( &self, url: *const c_void, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<DynamicLibrary>, Option<Error>) + Send + 'static,

Create a new dynamic library from a URL asynchronously.

C++ equivalent: CompilerTask* newDynamicLibrary(const NS::URL*, NewDynamicLibraryCompletionHandler)

§Safety

The URL pointer must be valid.

Source

pub fn new_compute_pipeline_state_with_dynamic_linking_async<F>( &self, descriptor: &ComputePipelineDescriptor, dynamic_linking: &PipelineStageDynamicLinkingDescriptor, options: Option<&CompilerTaskOptions>, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<ComputePipelineState>, Option<Error>) + Send + 'static,

Create a new compute pipeline state with dynamic linking asynchronously.

C++ equivalent: CompilerTask* newComputePipelineState(..., dynamicLinkingDescriptor, ..., completionHandler)

Source

pub fn new_render_pipeline_state_with_dynamic_linking_async<F>( &self, descriptor: &PipelineDescriptor, dynamic_linking: &RenderPipelineDynamicLinkingDescriptor, options: Option<&CompilerTaskOptions>, completion_handler: F, ) -> Option<CompilerTask>
where F: Fn(Option<RenderPipelineState>, Option<Error>) + Send + 'static,

Create a new render pipeline state with dynamic linking asynchronously.

C++ equivalent: CompilerTask* newRenderPipelineState(..., dynamicLinkingDescriptor, ..., completionHandler)

Source

pub fn new_machine_learning_pipeline_state( &self, descriptor: &MachineLearningPipelineDescriptor, options: Option<&CompilerTaskOptions>, ) -> Result<MachineLearningPipelineState, Error>

Create a new machine learning pipeline state synchronously.

C++ equivalent: MTL4::MachineLearningPipelineState* newMachineLearningPipelineState(..., NS::Error**)

Source

pub fn new_machine_learning_pipeline_state_async<F>( &self, descriptor: &MachineLearningPipelineDescriptor, options: Option<&CompilerTaskOptions>, completion_handler: F, ) -> Option<CompilerTask>

Create a new machine learning pipeline state asynchronously.

C++ equivalent: CompilerTask* newMachineLearningPipelineState(..., completionHandler)

Trait Implementations§

Source§

impl Clone for Compiler

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Compiler

Source§

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

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

impl Drop for Compiler

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Referencing for Compiler

Source§

fn as_ptr(&self) -> *const c_void

Get the raw pointer to the Objective-C object.
Source§

fn as_mut_ptr(&self) -> *mut c_void

Get the raw mutable pointer to the Objective-C object.
Source§

fn retain(&self) -> Self
where Self: Clone,

Retain the object, incrementing its reference count. Read more
Source§

fn release(&self)

Release the object, decrementing its reference count. Read more
Source§

fn autorelease(&self) -> Self
where Self: Clone,

Autorelease the object. Read more
Source§

fn retain_count(&self) -> usize

Get the retain count of the object. Read more
Source§

impl Send for Compiler

Source§

impl Sync for Compiler

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.