Debian Codegraph @

third_party/rust/metal/src/computepass.rs

raw
1 use super::*;
2
3 /// See <https://developer.apple.com/documentation/metal/mtlcomputepassdescriptor>
4 pub enum MTLComputePassDescriptor {}
5
6 foreign_obj_type! {
7 type CType = MTLComputePassDescriptor;
8 pub struct ComputePassDescriptor;
9 }
10
11 impl ComputePassDescriptor {
12 /// Creates a default compute pass descriptor with no attachments.
13 pub fn new<'a>() -> &'a ComputePassDescriptorRef {
14 unsafe { msg_send![class!(MTLComputePassDescriptor), computePassDescriptor] }
15 }
16 }
17
18 impl ComputePassDescriptorRef {
19 pub fn sample_buffer_attachments(
20 &self,
21 ) -> &ComputePassSampleBufferAttachmentDescriptorArrayRef {
22 unsafe { msg_send![self, sampleBufferAttachments] }
23 }
24
25 pub fn set_dispatch_type(&self, ty: MTLDispatchType) {
26 unsafe { msg_send![self, setDispatchType: ty] }
27 }
28 }
29
30 /// See <https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptorarray>
31 pub enum MTLComputePassSampleBufferAttachmentDescriptorArray {}
32
33 foreign_obj_type! {
34 type CType = MTLComputePassSampleBufferAttachmentDescriptorArray;
35 pub struct ComputePassSampleBufferAttachmentDescriptorArray;
36 }
37
38 impl ComputePassSampleBufferAttachmentDescriptorArrayRef {
39 pub fn object_at(
40 &self,
41 index: NSUInteger,
42 ) -> Option<&ComputePassSampleBufferAttachmentDescriptorRef> {
43 unsafe { msg_send![self, objectAtIndexedSubscript: index] }
44 }
45
46 pub fn set_object_at(
47 &self,
48 index: NSUInteger,
49 attachment: Option<&ComputePassSampleBufferAttachmentDescriptorRef>,
50 ) {
51 unsafe {
52 msg_send![self, setObject:attachment
53 atIndexedSubscript:index]
54 }
55 }
56 }
57
58 /// See <https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptor>
59 pub enum MTLComputePassSampleBufferAttachmentDescriptor {}
60
61 foreign_obj_type! {
62 type CType = MTLComputePassSampleBufferAttachmentDescriptor;
63 pub struct ComputePassSampleBufferAttachmentDescriptor;
64 }
65
66 impl ComputePassSampleBufferAttachmentDescriptor {
67 pub fn new() -> Self {
68 let class = class!(MTLComputePassSampleBufferAttachmentDescriptor);
69 unsafe { msg_send![class, new] }
70 }
71 }
72
73 impl ComputePassSampleBufferAttachmentDescriptorRef {
74 pub fn sample_buffer(&self) -> Option<&CounterSampleBufferRef> {
75 unsafe { msg_send![self, sampleBuffer] }
76 }
77
78 pub fn set_sample_buffer(&self, sample_buffer: &CounterSampleBufferRef) {
79 unsafe { msg_send![self, setSampleBuffer: sample_buffer] }
80 }
81
82 pub fn start_of_encoder_sample_index(&self) -> NSUInteger {
83 unsafe { msg_send![self, startOfEncoderSampleIndex] }
84 }
85
86 pub fn set_start_of_encoder_sample_index(&self, start_of_encoder_sample_index: NSUInteger) {
87 unsafe {
88 msg_send![
89 self,
90 setStartOfEncoderSampleIndex: start_of_encoder_sample_index
91 ]
92 }
93 }
94
95 pub fn end_of_encoder_sample_index(&self) -> NSUInteger {
96 unsafe { msg_send![self, endOfEncoderSampleIndex] }
97 }
98
99 pub fn set_end_of_encoder_sample_index(&self, end_of_encoder_sample_index: NSUInteger) {
100 unsafe {
101 msg_send![
102 self,
103 setEndOfEncoderSampleIndex: end_of_encoder_sample_index
104 ]
105 }
106 }
107 }