Debian Codegraph @

third_party/rust/metal/src/commandqueue.rs

raw
1 // Copyright 2016 GFX developers
2 //
3 // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4 // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5 // http://opensource.org/licenses/MIT>, at your option. This file may not be
6 // copied, modified, or distributed except according to those terms.
7
8 use super::*;
9
10 /// See <https://developer.apple.com/documentation/metal/mtlcommandqueue>.
11 pub enum MTLCommandQueue {}
12
13 foreign_obj_type! {
14 type CType = MTLCommandQueue;
15 pub struct CommandQueue;
16 }
17
18 impl CommandQueueRef {
19 pub fn label(&self) -> &str {
20 unsafe {
21 let label = msg_send![self, label];
22 crate::nsstring_as_str(label)
23 }
24 }
25
26 pub fn set_label(&self, label: &str) {
27 unsafe {
28 let nslabel = crate::nsstring_from_str(label);
29 let () = msg_send![self, setLabel: nslabel];
30 }
31 }
32
33 pub fn new_command_buffer(&self) -> &CommandBufferRef {
34 unsafe { msg_send![self, commandBuffer] }
35 }
36
37 pub fn new_command_buffer_with_unretained_references(&self) -> &CommandBufferRef {
38 unsafe { msg_send![self, commandBufferWithUnretainedReferences] }
39 }
40
41 pub fn device(&self) -> &DeviceRef {
42 unsafe { msg_send![self, device] }
43 }
44 }