//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptor?language=objc)
    #[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!(
        #[cfg(feature = "MTLCounters")]
        /// 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 sampleBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;

        #[cfg(feature = "MTLCounters")]
        /// Setter for [`sampleBuffer`][Self::sampleBuffer].
        #[unsafe(method(setSampleBuffer:))]
        #[unsafe(method_family = none)]
        pub fn setSampleBuffer(
            &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 startOfEncoderSampleIndex(&self) -> NSUInteger;

        /// Setter for [`startOfEncoderSampleIndex`][Self::startOfEncoderSampleIndex].
        ///
        /// # Safety
        ///
        /// This might not be bounds-checked.
        #[unsafe(method(setStartOfEncoderSampleIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setStartOfEncoderSampleIndex(
            &self,
            start_of_encoder_sample_index: NSUInteger,
        );

        /// 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 endOfEncoderSampleIndex(&self) -> NSUInteger;

        /// Setter for [`endOfEncoderSampleIndex`][Self::endOfEncoderSampleIndex].
        ///
        /// # Safety
        ///
        /// This might not be bounds-checked.
        #[unsafe(method(setEndOfEncoderSampleIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEndOfEncoderSampleIndex(&self, end_of_encoder_sample_index: NSUInteger);
    );
}

/// Methods declared on superclass `NSObject`.
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>;
    );
}

impl DefaultRetained for MTLComputePassSampleBufferAttachmentDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptorarray?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTLComputePassSampleBufferAttachmentDescriptorArray;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MTLComputePassSampleBufferAttachmentDescriptorArray {}
);

impl MTLComputePassSampleBufferAttachmentDescriptorArray {
    extern_methods!(
        /// # Safety
        ///
        /// `attachmentIndex` might not be bounds-checked.
        #[unsafe(method(objectAtIndexedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectAtIndexedSubscript(
            &self,
            attachment_index: NSUInteger,
        ) -> Retained<MTLComputePassSampleBufferAttachmentDescriptor>;

        /// # Safety
        ///
        /// `attachmentIndex` might not be bounds-checked.
        #[unsafe(method(setObject:atIndexedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_atIndexedSubscript(
            &self,
            attachment: Option<&MTLComputePassSampleBufferAttachmentDescriptor>,
            attachment_index: NSUInteger,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl MTLComputePassSampleBufferAttachmentDescriptorArray {
    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>;
    );
}

impl DefaultRetained for MTLComputePassSampleBufferAttachmentDescriptorArray {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// MTLComputePassDescriptor represents a collection of attachments to be used to create a concrete compute command encoder
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcomputepassdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTLComputePassDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTLComputePassDescriptor {}
);

unsafe impl CopyingHelper for MTLComputePassDescriptor {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MTLComputePassDescriptor {}
);

impl MTLComputePassDescriptor {
    extern_methods!(
        /// Create an autoreleased default frame buffer descriptor
        #[unsafe(method(computePassDescriptor))]
        #[unsafe(method_family = none)]
        pub fn computePassDescriptor() -> Retained<MTLComputePassDescriptor>;

        #[cfg(feature = "MTLCommandBuffer")]
        /// The dispatch type of the compute command encoder.
        #[unsafe(method(dispatchType))]
        #[unsafe(method_family = none)]
        pub fn dispatchType(&self) -> MTLDispatchType;

        #[cfg(feature = "MTLCommandBuffer")]
        /// Setter for [`dispatchType`][Self::dispatchType].
        #[unsafe(method(setDispatchType:))]
        #[unsafe(method_family = none)]
        pub fn setDispatchType(&self, dispatch_type: MTLDispatchType);

        /// An array of sample buffers and associated sample indices.
        #[unsafe(method(sampleBufferAttachments))]
        #[unsafe(method_family = none)]
        pub fn sampleBufferAttachments(
            &self,
        ) -> Retained<MTLComputePassSampleBufferAttachmentDescriptorArray>;
    );
}

/// Methods declared on superclass `NSObject`.
impl MTLComputePassDescriptor {
    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>;
    );
}

impl DefaultRetained for MTLComputePassDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
