objc2_metal_performance_shaders/generated/MPSNeuralNetwork/
MPSNNGridSample.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    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnngridsample?language=objc)
13    #[unsafe(super(MPSCNNBinaryKernel, MPSKernel, NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
16    pub struct MPSNNGridSample;
17);
18
19#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
20extern_conformance!(
21    unsafe impl NSCoding for MPSNNGridSample {}
22);
23
24#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
25extern_conformance!(
26    unsafe impl NSCopying for MPSNNGridSample {}
27);
28
29#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
30unsafe impl CopyingHelper for MPSNNGridSample {
31    type Result = Self;
32}
33
34#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
35extern_conformance!(
36    unsafe impl NSObjectProtocol for MPSNNGridSample {}
37);
38
39#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
40extern_conformance!(
41    unsafe impl NSSecureCoding for MPSNNGridSample {}
42);
43
44#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
45impl MPSNNGridSample {
46    extern_methods!(
47        /// This determines whether the pixel locations from the grid are used as the input coordinate (if set to YES) or
48        /// is added to the input coordinate (if set to NO).
49        /// The default value is YES.
50        #[unsafe(method(useGridValueAsInputCoordinate))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn useGridValueAsInputCoordinate(&self) -> bool;
53
54        /// Setter for [`useGridValueAsInputCoordinate`][Self::useGridValueAsInputCoordinate].
55        #[unsafe(method(setUseGridValueAsInputCoordinate:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn setUseGridValueAsInputCoordinate(
58            &self,
59            use_grid_value_as_input_coordinate: bool,
60        );
61
62        /// Create a grid sample kernel.
63        ///
64        /// Parameter `device`: The device the filter will run on
65        ///
66        /// Returns: A valid MPSNNGridSample object or nil, if failure.
67        #[unsafe(method(initWithDevice:))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn initWithDevice(
70            this: Allocated<Self>,
71            device: &ProtocolObject<dyn MTLDevice>,
72        ) -> Retained<Self>;
73
74        /// NSSecureCoding compatability
75        ///
76        /// While the standard NSSecureCoding/NSCoding method
77        /// -initWithCoder: should work, since the file can't
78        /// know which device your data is allocated on, we
79        /// have to guess and may guess incorrectly.  To avoid
80        /// that problem, use initWithCoder:device instead.
81        ///
82        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
83        ///
84        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
85        ///
86        /// Returns: A new MPSKernel object, or nil if failure.
87        ///
88        /// # Safety
89        ///
90        /// `a_decoder` possibly has further requirements.
91        #[unsafe(method(initWithCoder:device:))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn initWithCoder_device(
94            this: Allocated<Self>,
95            a_decoder: &NSCoder,
96            device: &ProtocolObject<dyn MTLDevice>,
97        ) -> Option<Retained<Self>>;
98    );
99}
100
101/// Methods declared on superclass `MPSKernel`.
102#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
103impl MPSNNGridSample {
104    extern_methods!(
105        /// Called by NSCoder to decode MPSKernels
106        ///
107        /// This isn't the right interface to decode a MPSKernel, but
108        /// it is the one that NSCoder uses. To enable your NSCoder
109        /// (e.g. NSKeyedUnarchiver) to set which device to use
110        /// extend the object to adopt the MPSDeviceProvider
111        /// protocol. Otherwise, the Metal system default device
112        /// will be used.
113        ///
114        /// # Safety
115        ///
116        /// `a_decoder` possibly has further requirements.
117        #[unsafe(method(initWithCoder:))]
118        #[unsafe(method_family = init)]
119        pub unsafe fn initWithCoder(
120            this: Allocated<Self>,
121            a_decoder: &NSCoder,
122        ) -> Option<Retained<Self>>;
123    );
124}
125
126/// Methods declared on superclass `NSObject`.
127#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
128impl MPSNNGridSample {
129    extern_methods!(
130        #[unsafe(method(init))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
133
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub unsafe fn new() -> Retained<Self>;
137    );
138}