objc2_metal/generated/
MTL4ComputePipeline.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Describes a compute pipeline state.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4computepipelinedescriptor?language=objc)
14    #[unsafe(super(MTL4PipelineDescriptor, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(feature = "MTL4PipelineState")]
17    pub struct MTL4ComputePipelineDescriptor;
18);
19
20#[cfg(feature = "MTL4PipelineState")]
21extern_conformance!(
22    unsafe impl NSCopying for MTL4ComputePipelineDescriptor {}
23);
24
25#[cfg(feature = "MTL4PipelineState")]
26unsafe impl CopyingHelper for MTL4ComputePipelineDescriptor {
27    type Result = Self;
28}
29
30#[cfg(feature = "MTL4PipelineState")]
31extern_conformance!(
32    unsafe impl NSObjectProtocol for MTL4ComputePipelineDescriptor {}
33);
34
35#[cfg(feature = "MTL4PipelineState")]
36impl MTL4ComputePipelineDescriptor {
37    extern_methods!(
38        #[cfg(feature = "MTL4FunctionDescriptor")]
39        /// A descriptor representing the compute pipeline's function.
40        ///
41        /// You don't assign instances of ``MTL4FunctionDescriptor`` to this property directly, instead
42        /// assign an instance of one of its subclasses, such as ``MTL4LibraryFunctionDescriptor``, which
43        /// represents a function from a Metal library.
44        #[unsafe(method(computeFunctionDescriptor))]
45        #[unsafe(method_family = none)]
46        pub fn computeFunctionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;
47
48        #[cfg(feature = "MTL4FunctionDescriptor")]
49        /// Setter for [`computeFunctionDescriptor`][Self::computeFunctionDescriptor].
50        ///
51        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
52        #[unsafe(method(setComputeFunctionDescriptor:))]
53        #[unsafe(method_family = none)]
54        pub fn setComputeFunctionDescriptor(
55            &self,
56            compute_function_descriptor: Option<&MTL4FunctionDescriptor>,
57        );
58
59        /// A boolean value indicating whether each dimension of the threadgroup size is a multiple of its
60        /// corresponding thread execution width.
61        #[unsafe(method(threadGroupSizeIsMultipleOfThreadExecutionWidth))]
62        #[unsafe(method_family = none)]
63        pub fn threadGroupSizeIsMultipleOfThreadExecutionWidth(&self) -> bool;
64
65        /// Setter for [`threadGroupSizeIsMultipleOfThreadExecutionWidth`][Self::threadGroupSizeIsMultipleOfThreadExecutionWidth].
66        #[unsafe(method(setThreadGroupSizeIsMultipleOfThreadExecutionWidth:))]
67        #[unsafe(method_family = none)]
68        pub fn setThreadGroupSizeIsMultipleOfThreadExecutionWidth(
69            &self,
70            thread_group_size_is_multiple_of_thread_execution_width: bool,
71        );
72
73        /// The maximum total number of threads that Metal can execute in a single threadgroup for the
74        /// compute function.
75        #[unsafe(method(maxTotalThreadsPerThreadgroup))]
76        #[unsafe(method_family = none)]
77        pub fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
78
79        /// Setter for [`maxTotalThreadsPerThreadgroup`][Self::maxTotalThreadsPerThreadgroup].
80        #[unsafe(method(setMaxTotalThreadsPerThreadgroup:))]
81        #[unsafe(method_family = none)]
82        pub fn setMaxTotalThreadsPerThreadgroup(
83            &self,
84            max_total_threads_per_threadgroup: NSUInteger,
85        );
86
87        #[cfg(feature = "MTLTypes")]
88        /// The required number of threads per threadgroup for compute dispatches.
89        ///
90        /// When you set this value, you are responsible for ensuring that the `threadsPerThreadgroup` argument of any compute
91        /// dispatch matches it.
92        ///
93        /// Setting this property is optional, except in cases where the pipeline uses *CooperativeTensors*.
94        ///
95        /// This property's default value is `0`, which disables its effect.
96        #[unsafe(method(requiredThreadsPerThreadgroup))]
97        #[unsafe(method_family = none)]
98        pub fn requiredThreadsPerThreadgroup(&self) -> MTLSize;
99
100        #[cfg(feature = "MTLTypes")]
101        /// Setter for [`requiredThreadsPerThreadgroup`][Self::requiredThreadsPerThreadgroup].
102        #[unsafe(method(setRequiredThreadsPerThreadgroup:))]
103        #[unsafe(method_family = none)]
104        pub fn setRequiredThreadsPerThreadgroup(&self, required_threads_per_threadgroup: MTLSize);
105
106        /// A boolean value indicating whether the compute pipeline supports linking binary functions.
107        #[unsafe(method(supportBinaryLinking))]
108        #[unsafe(method_family = none)]
109        pub fn supportBinaryLinking(&self) -> bool;
110
111        /// Setter for [`supportBinaryLinking`][Self::supportBinaryLinking].
112        #[unsafe(method(setSupportBinaryLinking:))]
113        #[unsafe(method_family = none)]
114        pub fn setSupportBinaryLinking(&self, support_binary_linking: bool);
115
116        #[cfg(feature = "MTL4LinkingDescriptor")]
117        /// An object that contains information about functions to link to the compute pipeline.
118        #[unsafe(method(staticLinkingDescriptor))]
119        #[unsafe(method_family = none)]
120        pub fn staticLinkingDescriptor(&self) -> Option<Retained<MTL4StaticLinkingDescriptor>>;
121
122        #[cfg(feature = "MTL4LinkingDescriptor")]
123        /// Setter for [`staticLinkingDescriptor`][Self::staticLinkingDescriptor].
124        ///
125        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
126        #[unsafe(method(setStaticLinkingDescriptor:))]
127        #[unsafe(method_family = none)]
128        pub fn setStaticLinkingDescriptor(
129            &self,
130            static_linking_descriptor: Option<&MTL4StaticLinkingDescriptor>,
131        );
132
133        /// A value indicating whether the pipeline supports Metal indirect command buffers.
134        #[unsafe(method(supportIndirectCommandBuffers))]
135        #[unsafe(method_family = none)]
136        pub fn supportIndirectCommandBuffers(&self) -> MTL4IndirectCommandBufferSupportState;
137
138        /// Setter for [`supportIndirectCommandBuffers`][Self::supportIndirectCommandBuffers].
139        #[unsafe(method(setSupportIndirectCommandBuffers:))]
140        #[unsafe(method_family = none)]
141        pub fn setSupportIndirectCommandBuffers(
142            &self,
143            support_indirect_command_buffers: MTL4IndirectCommandBufferSupportState,
144        );
145
146        /// Resets the descriptor to its default values.
147        #[unsafe(method(reset))]
148        #[unsafe(method_family = none)]
149        pub fn reset(&self);
150    );
151}
152
153/// Methods declared on superclass `NSObject`.
154#[cfg(feature = "MTL4PipelineState")]
155impl MTL4ComputePipelineDescriptor {
156    extern_methods!(
157        #[unsafe(method(init))]
158        #[unsafe(method_family = init)]
159        pub fn init(this: Allocated<Self>) -> Retained<Self>;
160
161        #[unsafe(method(new))]
162        #[unsafe(method_family = new)]
163        pub fn new() -> Retained<Self>;
164    );
165}
166
167#[cfg(feature = "MTL4PipelineState")]
168impl DefaultRetained for MTL4ComputePipelineDescriptor {
169    #[inline]
170    fn default_retained() -> Retained<Self> {
171        Self::new()
172    }
173}