objc2_metal_performance_shaders/generated/MPSNDArray/
MPSNDArrayGradientState.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6use objc2_metal::*;
7
8use crate::*;
9
10extern_class!(
11    /// at the time an -encode call was made. The contents are opaque.
12    ///
13    /// Gradient states must be created with [MPSCNNKernel resultStateForSourceImage:sourceStates:destinationImage:]
14    /// or analogous interfaces.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsndarraygradientstate?language=objc)
17    #[unsafe(super(MPSState, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(all(feature = "MPSCore", feature = "MPSState"))]
20    pub struct MPSNDArrayGradientState;
21);
22
23#[cfg(all(feature = "MPSCore", feature = "MPSState"))]
24extern_conformance!(
25    unsafe impl NSObjectProtocol for MPSNDArrayGradientState {}
26);
27
28#[cfg(all(feature = "MPSCore", feature = "MPSState"))]
29impl MPSNDArrayGradientState {
30    extern_methods!();
31}
32
33/// Methods declared on superclass `MPSState`.
34#[cfg(all(feature = "MPSCore", feature = "MPSState"))]
35impl MPSNDArrayGradientState {
36    extern_methods!(
37        /// Create a MPSState holding a temporary MTLBuffer
38        ///
39        /// Parameter `cmdBuf`: The command buffer against which the temporary resource is allocated
40        ///
41        /// Parameter `bufferSize`: The size of the buffer in bytes
42        #[unsafe(method(temporaryStateWithCommandBuffer:bufferSize:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn temporaryStateWithCommandBuffer_bufferSize(
45            cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
46            buffer_size: usize,
47        ) -> Retained<Self>;
48
49        /// Create a MPSState holding a temporary MTLTexture
50        ///
51        /// Parameter `cmdBuf`: The command buffer against which the temporary resource is allocated
52        ///
53        /// Parameter `descriptor`: A descriptor for the new temporary texture
54        #[unsafe(method(temporaryStateWithCommandBuffer:textureDescriptor:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn temporaryStateWithCommandBuffer_textureDescriptor(
57            cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
58            descriptor: &MTLTextureDescriptor,
59        ) -> Retained<Self>;
60
61        /// Create a new autoreleased temporary state object without underlying resource
62        ///
63        /// Parameter `cmdBuf`: The command buffer with which the temporary resource is associated
64        #[unsafe(method(temporaryStateWithCommandBuffer:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn temporaryStateWithCommandBuffer(
67            cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
68        ) -> Retained<Self>;
69
70        #[unsafe(method(initWithDevice:bufferSize:))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn initWithDevice_bufferSize(
73            this: Allocated<Self>,
74            device: &ProtocolObject<dyn MTLDevice>,
75            buffer_size: usize,
76        ) -> Retained<Self>;
77
78        #[unsafe(method(initWithDevice:textureDescriptor:))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn initWithDevice_textureDescriptor(
81            this: Allocated<Self>,
82            device: &ProtocolObject<dyn MTLDevice>,
83            descriptor: &MTLTextureDescriptor,
84        ) -> Retained<Self>;
85
86        /// Create a MPSState with a non-temporary MTLResource
87        ///
88        /// Parameter `resource`: A MTLBuffer or MTLTexture. May be nil.
89        ///
90        /// # Safety
91        ///
92        /// - `resource` may need to be synchronized.
93        /// - `resource` may be unretained, you must ensure it is kept alive while in use.
94        #[unsafe(method(initWithResource:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithResource(
97            this: Allocated<Self>,
98            resource: Option<&ProtocolObject<dyn MTLResource>>,
99        ) -> Retained<Self>;
100
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
104
105        /// Initialize a non-temporary state to hold a number of textures and buffers
106        ///
107        /// The allocation of each resource will be deferred  until it is needed.
108        /// This occurs when -resource or -resourceAtIndex: is called.
109        ///
110        /// Parameter `resourceList`: The list of resources to create.
111        #[unsafe(method(initWithDevice:resourceList:))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn initWithDevice_resourceList(
114            this: Allocated<Self>,
115            device: &ProtocolObject<dyn MTLDevice>,
116            resource_list: &MPSStateResourceList,
117        ) -> Retained<Self>;
118
119        /// Initialize a temporary state to hold a number of textures and buffers
120        ///
121        /// The textures occur first in sequence
122        #[unsafe(method(temporaryStateWithCommandBuffer:resourceList:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn temporaryStateWithCommandBuffer_resourceList(
125            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
126            resource_list: &MPSStateResourceList,
127        ) -> Retained<Self>;
128
129        /// Create a state object with a list of MTLResources
130        ///
131        /// Because MPS prefers deferred allocation of resources
132        /// your application should use -initWithTextures:bufferSizes:bufferCount:
133        /// whenever possible. This method is useful for cases when the
134        /// MTLResources must be initialized by the CPU.
135        ///
136        /// # Safety
137        ///
138        /// - `resources` generic may need to be synchronized.
139        /// - `resources` generic may be unretained, you must ensure it is kept alive while in use.
140        #[unsafe(method(initWithResources:))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn initWithResources(
143            this: Allocated<Self>,
144            resources: Option<&NSArray<ProtocolObject<dyn MTLResource>>>,
145        ) -> Retained<Self>;
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150#[cfg(all(feature = "MPSCore", feature = "MPSState"))]
151impl MPSNDArrayGradientState {
152    extern_methods!(
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new() -> Retained<Self>;
156    );
157}