Struct MTLLibrary

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

Implementations§

Source§

impl MTLLibrary

Source

pub unsafe fn new_function_with_name( &self, name: *mut NSString, ) -> Strong<MTLFunction>

Examples found in repository?
examples/hello_triangle.rs (line 169)
167unsafe fn create_pipeline_state(device: &MTLDevice, shader_lib: &MTLLibrary) -> Strong<MTLRenderPipelineState> {
168
169  let mut vertex_shader = shader_lib.new_function_with_name(&mut *util::string("vs"));
170  let mut frag_shader = shader_lib.new_function_with_name(&mut *util::string("ps"));
171
172  let mut descriptor = MTLRenderPipelineDescriptor::new();
173  descriptor.set_vertex_function(&mut *vertex_shader);
174  descriptor.set_fragment_function(&mut *frag_shader);
175
176  let color_attachments = descriptor.color_attachments().as_ref().unwrap();
177
178  let color_attachment_descriptor = color_attachments.object_at_indexed_subscript(0).as_ref().unwrap();
179  color_attachment_descriptor.set_pixel_format(MTLPixelFormat::RGBA8Unorm);
180
181  let pipeline_state = device.new_render_pipeline_state_with_descriptor_error(&mut *descriptor, 0 as *mut NSError);
182  // TODO: Check error.
183
184  assert!(!pipeline_state.is_null());
185
186  pipeline_state
187}

Trait Implementations§

Source§

impl Message for MTLLibrary

Source§

unsafe fn send_message<A, R>( &self, sel: Sel, args: A, ) -> Result<R, MessageError>
where Self: Sized, A: MessageArguments, R: Any,

Sends a message to self with the given selector and arguments. Read more
Source§

fn verify_message<A, R>(&self, sel: Sel) -> Result<(), MessageError>
where Self: Sized, A: EncodeArguments, R: Encode,

Verifies that the argument and return types match the encoding of the method for the given selector. Read more

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> 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, 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.