objc2_metal_performance_shaders/generated/MPSNDArray/
MPSNDArrayMatrixMultiplication.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::*;
7use objc2_metal::*;
8
9use crate::*;
10
11extern_class!(
12    /// Dependencies: This depends on Metal.framework.
13    ///
14    ///
15    /// A matrix multiplication kernel operating on MPSNDArray objects.
16    ///
17    ///
18    /// A MPSNDArrayMatrixMultiplication object computes, for each 2-D matrix within
19    /// a 4-D MPSNDArray object:
20    ///
21    /// D = alpha * A * B + beta * C
22    ///
23    /// A, B, C, and D are matrices which are represented by objects stored
24    /// in the two most major dimensions of the MPSNDArray. alpha and beta
25    /// are scalar values (of the same data type as values of D and C) which
26    /// are applied as shown above.
27    ///
28    /// If an input's 3rd or 4th dimension is 1 its data will be broadcast as
29    /// appropriate to the remaining input's 3rd or 4th dimension respectively.
30    ///
31    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsndarraymatrixmultiplication?language=objc)
32    #[unsafe(super(MPSNDArrayMultiaryKernel, MPSNDArrayMultiaryBase, MPSKernel, NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    #[cfg(all(
35        feature = "MPSCore",
36        feature = "MPSKernel",
37        feature = "MPSNDArrayKernel"
38    ))]
39    pub struct MPSNDArrayMatrixMultiplication;
40);
41
42#[cfg(all(
43    feature = "MPSCore",
44    feature = "MPSKernel",
45    feature = "MPSNDArrayKernel"
46))]
47extern_conformance!(
48    unsafe impl NSCoding for MPSNDArrayMatrixMultiplication {}
49);
50
51#[cfg(all(
52    feature = "MPSCore",
53    feature = "MPSKernel",
54    feature = "MPSNDArrayKernel"
55))]
56extern_conformance!(
57    unsafe impl NSCopying for MPSNDArrayMatrixMultiplication {}
58);
59
60#[cfg(all(
61    feature = "MPSCore",
62    feature = "MPSKernel",
63    feature = "MPSNDArrayKernel"
64))]
65unsafe impl CopyingHelper for MPSNDArrayMatrixMultiplication {
66    type Result = Self;
67}
68
69#[cfg(all(
70    feature = "MPSCore",
71    feature = "MPSKernel",
72    feature = "MPSNDArrayKernel"
73))]
74extern_conformance!(
75    unsafe impl NSObjectProtocol for MPSNDArrayMatrixMultiplication {}
76);
77
78#[cfg(all(
79    feature = "MPSCore",
80    feature = "MPSKernel",
81    feature = "MPSNDArrayKernel"
82))]
83extern_conformance!(
84    unsafe impl NSSecureCoding for MPSNDArrayMatrixMultiplication {}
85);
86
87#[cfg(all(
88    feature = "MPSCore",
89    feature = "MPSKernel",
90    feature = "MPSNDArrayKernel"
91))]
92impl MPSNDArrayMatrixMultiplication {
93    extern_methods!(
94        /// The scale factor to apply to the product.  Specified in double
95        /// precision.  Will be converted to the appropriate precision in the
96        /// implementation subject to rounding and/or clamping as necessary.
97        /// Defaults to 1.0 at initialization time.
98        #[unsafe(method(alpha))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn alpha(&self) -> c_double;
101
102        /// Setter for [`alpha`][Self::alpha].
103        #[unsafe(method(setAlpha:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setAlpha(&self, alpha: c_double);
106
107        /// The scale factor to apply to the addend if available.  Specified in double
108        /// precision.  Will be converted to the appropriate precision in the
109        /// implementation subject to rounding and/or clamping as necessary.
110        /// Defaults to 1.0 at initialization time.
111        #[unsafe(method(beta))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn beta(&self) -> c_double;
114
115        /// Setter for [`beta`][Self::beta].
116        #[unsafe(method(setBeta:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setBeta(&self, beta: c_double);
119    );
120}
121
122/// Methods declared on superclass `MPSNDArrayMultiaryKernel`.
123#[cfg(all(
124    feature = "MPSCore",
125    feature = "MPSKernel",
126    feature = "MPSNDArrayKernel"
127))]
128impl MPSNDArrayMatrixMultiplication {
129    extern_methods!(
130        #[unsafe(method(initWithDevice:sourceCount:))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn initWithDevice_sourceCount(
133            this: Allocated<Self>,
134            device: &ProtocolObject<dyn MTLDevice>,
135            count: NSUInteger,
136        ) -> Retained<Self>;
137
138        /// # Safety
139        ///
140        /// `coder` possibly has further requirements.
141        #[unsafe(method(initWithCoder:device:))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn initWithCoder_device(
144            this: Allocated<Self>,
145            coder: &NSCoder,
146            device: &ProtocolObject<dyn MTLDevice>,
147        ) -> Retained<Self>;
148    );
149}
150
151/// Methods declared on superclass `MPSNDArrayMultiaryBase`.
152#[cfg(all(
153    feature = "MPSCore",
154    feature = "MPSKernel",
155    feature = "MPSNDArrayKernel"
156))]
157impl MPSNDArrayMatrixMultiplication {
158    extern_methods!(
159        #[unsafe(method(initWithDevice:))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn initWithDevice(
162            this: Allocated<Self>,
163            device: &ProtocolObject<dyn MTLDevice>,
164        ) -> Retained<Self>;
165    );
166}
167
168/// Methods declared on superclass `MPSKernel`.
169#[cfg(all(
170    feature = "MPSCore",
171    feature = "MPSKernel",
172    feature = "MPSNDArrayKernel"
173))]
174impl MPSNDArrayMatrixMultiplication {
175    extern_methods!(
176        /// Called by NSCoder to decode MPSKernels
177        ///
178        /// This isn't the right interface to decode a MPSKernel, but
179        /// it is the one that NSCoder uses. To enable your NSCoder
180        /// (e.g. NSKeyedUnarchiver) to set which device to use
181        /// extend the object to adopt the MPSDeviceProvider
182        /// protocol. Otherwise, the Metal system default device
183        /// will be used.
184        ///
185        /// # Safety
186        ///
187        /// `a_decoder` possibly has further requirements.
188        #[unsafe(method(initWithCoder:))]
189        #[unsafe(method_family = init)]
190        pub unsafe fn initWithCoder(
191            this: Allocated<Self>,
192            a_decoder: &NSCoder,
193        ) -> Option<Retained<Self>>;
194    );
195}
196
197/// Methods declared on superclass `NSObject`.
198#[cfg(all(
199    feature = "MPSCore",
200    feature = "MPSKernel",
201    feature = "MPSNDArrayKernel"
202))]
203impl MPSNDArrayMatrixMultiplication {
204    extern_methods!(
205        #[unsafe(method(init))]
206        #[unsafe(method_family = init)]
207        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
208
209        #[unsafe(method(new))]
210        #[unsafe(method_family = new)]
211        pub unsafe fn new() -> Retained<Self>;
212    );
213}