pub struct MTLLibrary(/* private fields */);Implementations§
Source§impl MTLLibrary
impl MTLLibrary
Sourcepub unsafe fn new_function_with_name(
&self,
name: *mut NSString,
) -> Strong<MTLFunction>
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
impl Message for MTLLibrary
Source§unsafe fn send_message<A, R>(
&self,
sel: Sel,
args: A,
) -> Result<R, MessageError>
unsafe fn send_message<A, R>( &self, sel: Sel, args: A, ) -> Result<R, MessageError>
Sends a message to self with the given selector and arguments. Read more
Source§fn verify_message<A, R>(&self, sel: Sel) -> Result<(), MessageError>
fn verify_message<A, R>(&self, sel: Sel) -> Result<(), MessageError>
Verifies that the argument and return types match the encoding of the
method for the given selector. Read more
Auto Trait Implementations§
impl Freeze for MTLLibrary
impl RefUnwindSafe for MTLLibrary
impl Send for MTLLibrary
impl Sync for MTLLibrary
impl Unpin for MTLLibrary
impl UnwindSafe for MTLLibrary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more