//! 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!(
    /// Describes a compute pipeline state.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4computepipelinedescriptor?language=objc)
    #[unsafe(super(MTL4PipelineDescriptor, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MTL4PipelineState")]
    pub struct MTL4ComputePipelineDescriptor;
);

#[cfg(feature = "MTL4PipelineState")]
extern_conformance!(
    unsafe impl NSCopying for MTL4ComputePipelineDescriptor {}
);

#[cfg(feature = "MTL4PipelineState")]
unsafe impl CopyingHelper for MTL4ComputePipelineDescriptor {
    type Result = Self;
}

#[cfg(feature = "MTL4PipelineState")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4ComputePipelineDescriptor {}
);

#[cfg(feature = "MTL4PipelineState")]
impl MTL4ComputePipelineDescriptor {
    extern_methods!(
        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// A descriptor representing the compute pipeline's function.
        ///
        /// You don't assign instances of ``MTL4FunctionDescriptor`` to this property directly, instead
        /// assign an instance of one of its subclasses, such as ``MTL4LibraryFunctionDescriptor``, which
        /// represents a function from a Metal library.
        #[unsafe(method(computeFunctionDescriptor))]
        #[unsafe(method_family = none)]
        pub fn computeFunctionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;

        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Setter for [`computeFunctionDescriptor`][Self::computeFunctionDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setComputeFunctionDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setComputeFunctionDescriptor(
            &self,
            compute_function_descriptor: Option<&MTL4FunctionDescriptor>,
        );

        /// A boolean value indicating whether each dimension of the threadgroup size is a multiple of its
        /// corresponding thread execution width.
        #[unsafe(method(threadGroupSizeIsMultipleOfThreadExecutionWidth))]
        #[unsafe(method_family = none)]
        pub fn threadGroupSizeIsMultipleOfThreadExecutionWidth(&self) -> bool;

        /// Setter for [`threadGroupSizeIsMultipleOfThreadExecutionWidth`][Self::threadGroupSizeIsMultipleOfThreadExecutionWidth].
        #[unsafe(method(setThreadGroupSizeIsMultipleOfThreadExecutionWidth:))]
        #[unsafe(method_family = none)]
        pub fn setThreadGroupSizeIsMultipleOfThreadExecutionWidth(
            &self,
            thread_group_size_is_multiple_of_thread_execution_width: bool,
        );

        /// The maximum total number of threads that Metal can execute in a single threadgroup for the
        /// compute function.
        #[unsafe(method(maxTotalThreadsPerThreadgroup))]
        #[unsafe(method_family = none)]
        pub fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;

        /// Setter for [`maxTotalThreadsPerThreadgroup`][Self::maxTotalThreadsPerThreadgroup].
        #[unsafe(method(setMaxTotalThreadsPerThreadgroup:))]
        #[unsafe(method_family = none)]
        pub fn setMaxTotalThreadsPerThreadgroup(
            &self,
            max_total_threads_per_threadgroup: NSUInteger,
        );

        #[cfg(feature = "MTLTypes")]
        /// The required number of threads per threadgroup for compute dispatches.
        ///
        /// When you set this value, you are responsible for ensuring that the `threadsPerThreadgroup` argument of any compute
        /// dispatch matches it.
        ///
        /// Setting this property is optional, except in cases where the pipeline uses *CooperativeTensors*.
        ///
        /// This property's default value is `0`, which disables its effect.
        #[unsafe(method(requiredThreadsPerThreadgroup))]
        #[unsafe(method_family = none)]
        pub fn requiredThreadsPerThreadgroup(&self) -> MTLSize;

        #[cfg(feature = "MTLTypes")]
        /// Setter for [`requiredThreadsPerThreadgroup`][Self::requiredThreadsPerThreadgroup].
        #[unsafe(method(setRequiredThreadsPerThreadgroup:))]
        #[unsafe(method_family = none)]
        pub fn setRequiredThreadsPerThreadgroup(&self, required_threads_per_threadgroup: MTLSize);

        /// A boolean value indicating whether the compute pipeline supports linking binary functions.
        #[unsafe(method(supportBinaryLinking))]
        #[unsafe(method_family = none)]
        pub fn supportBinaryLinking(&self) -> bool;

        /// Setter for [`supportBinaryLinking`][Self::supportBinaryLinking].
        #[unsafe(method(setSupportBinaryLinking:))]
        #[unsafe(method_family = none)]
        pub fn setSupportBinaryLinking(&self, support_binary_linking: bool);

        #[cfg(feature = "MTL4LinkingDescriptor")]
        /// An object that contains information about functions to link to the compute pipeline.
        #[unsafe(method(staticLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn staticLinkingDescriptor(&self) -> Option<Retained<MTL4StaticLinkingDescriptor>>;

        #[cfg(feature = "MTL4LinkingDescriptor")]
        /// Setter for [`staticLinkingDescriptor`][Self::staticLinkingDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setStaticLinkingDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setStaticLinkingDescriptor(
            &self,
            static_linking_descriptor: Option<&MTL4StaticLinkingDescriptor>,
        );

        /// A value indicating whether the pipeline supports Metal indirect command buffers.
        #[unsafe(method(supportIndirectCommandBuffers))]
        #[unsafe(method_family = none)]
        pub fn supportIndirectCommandBuffers(&self) -> MTL4IndirectCommandBufferSupportState;

        /// Setter for [`supportIndirectCommandBuffers`][Self::supportIndirectCommandBuffers].
        #[unsafe(method(setSupportIndirectCommandBuffers:))]
        #[unsafe(method_family = none)]
        pub fn setSupportIndirectCommandBuffers(
            &self,
            support_indirect_command_buffers: MTL4IndirectCommandBufferSupportState,
        );

        /// Resets the descriptor to its default values.
        #[unsafe(method(reset))]
        #[unsafe(method_family = none)]
        pub fn reset(&self);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "MTL4PipelineState")]
impl MTL4ComputePipelineDescriptor {
    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>;
    );
}

#[cfg(feature = "MTL4PipelineState")]
impl DefaultRetained for MTL4ComputePipelineDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
