1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use objc2::{
extern_class, extern_conformance, extern_methods,
rc::{Allocated, Retained},
runtime::{NSObject, ProtocolObject},
};
use objc2_foundation::{CopyingHelper, NSCopying, NSObjectProtocol};
use crate::counters::MTLCounterSampleBuffer;
extern_class!(
/// The sample buffer attachment descriptor for compute passes.
///
/// Availability: macOS 11.0+, iOS 14.0+
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLComputePassSampleBufferAttachmentDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLComputePassSampleBufferAttachmentDescriptor {}
);
unsafe impl CopyingHelper for MTLComputePassSampleBufferAttachmentDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLComputePassSampleBufferAttachmentDescriptor {}
);
impl MTLComputePassSampleBufferAttachmentDescriptor {
extern_methods!(
/// The sample buffer to store samples for the compute-pass defined samples.
///
/// If `sampleBuffer` is non-nil, the sample indices will be used to store samples into the sample buffer.
/// If no sample buffer is provided, no samples will be taken.
/// If any of the sample indices are specified as `MTLCounterDontSample`, no sample will be taken for that action.
#[unsafe(method(sampleBuffer))]
#[unsafe(method_family = none)]
pub fn sample_buffer(&self) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
/// Setter for `sample_buffer`.
#[unsafe(method(setSampleBuffer:))]
#[unsafe(method_family = none)]
pub fn set_sample_buffer(
&self,
sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
);
/// The sample index to use to store the sample taken at the start of command encoder processing.
/// Setting the value to `MTLCounterDontSample` will cause this sample to be omitted.
///
/// On devices where `MTLCounterSamplingPointAtStageBoundary` is unsupported, this sample index is invalid and must be set to `MTLCounterDontSample` or creation of a compute pass will fail.
#[unsafe(method(startOfEncoderSampleIndex))]
#[unsafe(method_family = none)]
pub fn start_of_encoder_sample_index(&self) -> usize;
#[unsafe(method(setStartOfEncoderSampleIndex:))]
#[unsafe(method_family = none)]
pub fn set_start_of_encoder_sample_index(
&self,
value: usize,
);
/// The sample index to use to store the sample taken at the end of command encoder processing.
/// Setting the value to `MTLCounterDontSample` will cause this sample to be omitted.
///
/// On devices where `MTLCounterSamplingPointAtStageBoundary` is unsupported, this sample index is invalid and must be set to `MTLCounterDontSample` or creation of a compute pass will fail.
#[unsafe(method(endOfEncoderSampleIndex))]
#[unsafe(method_family = none)]
pub fn end_of_encoder_sample_index(&self) -> usize;
#[unsafe(method(setEndOfEncoderSampleIndex:))]
#[unsafe(method_family = none)]
pub fn set_end_of_encoder_sample_index(
&self,
value: usize,
);
);
}
impl MTLComputePassSampleBufferAttachmentDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}