diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/rust/metal/src/computepass.rs | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/metal/src/computepass.rs')
-rw-r--r-- | third_party/rust/metal/src/computepass.rs | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/third_party/rust/metal/src/computepass.rs b/third_party/rust/metal/src/computepass.rs new file mode 100644 index 0000000000..50774d6871 --- /dev/null +++ b/third_party/rust/metal/src/computepass.rs @@ -0,0 +1,103 @@ +use super::*; + +/// See <https://developer.apple.com/documentation/metal/mtlcomputepassdescriptor> +pub enum MTLComputePassDescriptor {} + +foreign_obj_type! { + type CType = MTLComputePassDescriptor; + pub struct ComputePassDescriptor; +} + +impl ComputePassDescriptor { + /// Creates a default compute pass descriptor with no attachments. + pub fn new<'a>() -> &'a ComputePassDescriptorRef { + unsafe { msg_send![class!(MTLComputePassDescriptor), computePassDescriptor] } + } +} + +impl ComputePassDescriptorRef { + pub fn sample_buffer_attachments( + &self, + ) -> &ComputePassSampleBufferAttachmentDescriptorArrayRef { + unsafe { msg_send![self, sampleBufferAttachments] } + } +} + +/// See <https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptorarray> +pub enum MTLComputePassSampleBufferAttachmentDescriptorArray {} + +foreign_obj_type! { + type CType = MTLComputePassSampleBufferAttachmentDescriptorArray; + pub struct ComputePassSampleBufferAttachmentDescriptorArray; +} + +impl ComputePassSampleBufferAttachmentDescriptorArrayRef { + pub fn object_at( + &self, + index: NSUInteger, + ) -> Option<&ComputePassSampleBufferAttachmentDescriptorRef> { + unsafe { msg_send![self, objectAtIndexedSubscript: index] } + } + + pub fn set_object_at( + &self, + index: NSUInteger, + attachment: Option<&ComputePassSampleBufferAttachmentDescriptorRef>, + ) { + unsafe { + msg_send![self, setObject:attachment + atIndexedSubscript:index] + } + } +} + +/// See <https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptor> +pub enum MTLComputePassSampleBufferAttachmentDescriptor {} + +foreign_obj_type! { + type CType = MTLComputePassSampleBufferAttachmentDescriptor; + pub struct ComputePassSampleBufferAttachmentDescriptor; +} + +impl ComputePassSampleBufferAttachmentDescriptor { + pub fn new() -> Self { + let class = class!(MTLComputePassSampleBufferAttachmentDescriptor); + unsafe { msg_send![class, new] } + } +} + +impl ComputePassSampleBufferAttachmentDescriptorRef { + pub fn sample_buffer(&self) -> &CounterSampleBufferRef { + unsafe { msg_send![self, sampleBuffer] } + } + + pub fn set_sample_buffer(&self, sample_buffer: &CounterSampleBufferRef) { + unsafe { msg_send![self, setSampleBuffer: sample_buffer] } + } + + pub fn start_of_encoder_sample_index(&self) -> NSUInteger { + unsafe { msg_send![self, startOfEncoderSampleIndex] } + } + + pub fn set_start_of_encoder_sample_index(&self, start_of_encoder_sample_index: NSUInteger) { + unsafe { + msg_send![ + self, + setStartOfEncoderSampleIndex: start_of_encoder_sample_index + ] + } + } + + pub fn end_of_encoder_sample_index(&self) -> NSUInteger { + unsafe { msg_send![self, endOfEncoderSampleIndex] } + } + + pub fn set_end_of_encoder_sample_index(&self, end_of_encoder_sample_index: NSUInteger) { + unsafe { + msg_send![ + self, + setEndOfEncoderSampleIndex: end_of_encoder_sample_index + ] + } + } +} |