objc2-metal 0.3.2

Bindings to the Metal framework
Documentation
//! 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!(
    /// Groups together properties to drive a static linking process.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4staticlinkingdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4StaticLinkingDescriptor;
);

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

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

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

impl MTL4StaticLinkingDescriptor {
    extern_methods!(
        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Provides an array of functions to link at the Metal IR level.
        #[unsafe(method(functionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn functionDescriptors(&self) -> Option<Retained<NSArray<MTL4FunctionDescriptor>>>;

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

        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Provides an array of private functions to link at the Metal IR level.
        ///
        /// You specify private functions to link separately from ``functionDescriptors`` because pipelines don't export private functions as ``MTLFunctionHandle`` instances.
        /// - Note: You can link private functions even when your ``MTLDevice`` doesn't support function pointers.
        #[unsafe(method(privateFunctionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn privateFunctionDescriptors(
            &self,
        ) -> Option<Retained<NSArray<MTL4FunctionDescriptor>>>;

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

        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Assigns groups of functions to match call-site attributes in shader code.
        ///
        /// Function groups help the compiler reduce the number of candidate functions it needs to evaluate for shader function calls, potentially increasing runtime performance.
        #[unsafe(method(groups))]
        #[unsafe(method_family = none)]
        pub fn groups(
            &self,
        ) -> Option<Retained<NSDictionary<NSString, NSArray<MTL4FunctionDescriptor>>>>;

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

/// Methods declared on superclass `NSObject`.
impl MTL4StaticLinkingDescriptor {
    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 MTL4StaticLinkingDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// Groups together properties to drive the dynamic linking process of a pipeline stage.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4pipelinestagedynamiclinkingdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4PipelineStageDynamicLinkingDescriptor;
);

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

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

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

impl MTL4PipelineStageDynamicLinkingDescriptor {
    extern_methods!(
        /// Limits the maximum depth of the call stack for indirect function calls in the pipeline stage function.
        #[unsafe(method(maxCallStackDepth))]
        #[unsafe(method_family = none)]
        pub fn maxCallStackDepth(&self) -> NSUInteger;

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

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Provides the array of binary functions to link.
        ///
        /// Binary functions are shader functions that you compile from Metal IR to machine code ahead of time
        /// using instances of ``MTL4Compiler``.
        #[unsafe(method(binaryLinkedFunctions))]
        #[unsafe(method_family = none)]
        pub fn binaryLinkedFunctions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Setter for [`binaryLinkedFunctions`][Self::binaryLinkedFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBinaryLinkedFunctions:))]
        #[unsafe(method_family = none)]
        pub fn setBinaryLinkedFunctions(
            &self,
            binary_linked_functions: Option<&NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>,
        );

        #[cfg(feature = "MTLDynamicLibrary")]
        /// Provides an array of dynamic libraries the compiler loads when it builds the pipeline.
        #[unsafe(method(preloadedLibraries))]
        #[unsafe(method_family = none)]
        pub fn preloadedLibraries(
            &self,
        ) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;

        #[cfg(feature = "MTLDynamicLibrary")]
        /// Setter for [`preloadedLibraries`][Self::preloadedLibraries].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPreloadedLibraries:))]
        #[unsafe(method_family = none)]
        pub fn setPreloadedLibraries(
            &self,
            preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4PipelineStageDynamicLinkingDescriptor {
    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 MTL4PipelineStageDynamicLinkingDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// Groups together properties that provide linking properties for render pipelines.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinedynamiclinkingdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4RenderPipelineDynamicLinkingDescriptor;
);

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

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

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

impl MTL4RenderPipelineDynamicLinkingDescriptor {
    extern_methods!(
        /// Controls properties for linking the vertex stage of the render pipeline.
        #[unsafe(method(vertexLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn vertexLinkingDescriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for linking the fragment stage of the render pipeline.
        #[unsafe(method(fragmentLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn fragmentLinkingDescriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for linking the tile stage of the render pipeline.
        #[unsafe(method(tileLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn tileLinkingDescriptor(&self) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for link the object stage of the render pipeline.
        #[unsafe(method(objectLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn objectLinkingDescriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for linking the mesh stage of the render pipeline.
        #[unsafe(method(meshLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn meshLinkingDescriptor(&self) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4RenderPipelineDynamicLinkingDescriptor {
    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 MTL4RenderPipelineDynamicLinkingDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}