1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//! 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_protocol!(
/// A read-only container that stores pipeline states from a shader compiler.
///
/// The pipeline states can have intermediate representation (IR) binaries,
/// GPU- and system-specifc binaries, or a combination.
///
/// ## Topics
///
/// ### Identifiying the archive
/// - ``label``
///
/// ### Creating compute pipeline states
///
/// - ``newComputePipelineStateWithDescriptor:dynamicLinkingDescriptor:error:``
/// - ``newComputePipelineStateWithDescriptor:error:``
/// - ``newComputePipelineStateWithName:dynamicLinkingDescriptor:error:``
/// - ``newComputePipelineStateWithName:error:``
///
/// ### Creating reder pipeline states
///
/// - ``newRenderPipelineStateWithDescriptor:dynamicLinkingDescriptor:error:``
/// - ``newRenderPipelineStateWithDescriptor:error:``
/// - ``newRenderPipelineStateWithName:dynamicLinkingDescriptor:error:``
/// - ``newRenderPipelineStateWithName:error:``
///
/// ### Creating binary functions
///
/// - ``newBinaryFunctionWithDescriptor:functionType:error:``
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4archive?language=objc)
pub unsafe trait MTL4Archive: NSObjectProtocol + Send + Sync {
/// A label that you can associate with this archive.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
fn label(&self) -> Option<Retained<NSString>>;
/// Setter for [`label`][Self::label].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(all(
feature = "MTL4ComputePipeline",
feature = "MTL4PipelineState",
feature = "MTLAllocation",
feature = "MTLComputePipeline"
))]
/// Creates a compute pipeline state from the archive with a descriptor.
///
/// - Parameters:
/// - descriptor: A compute pipeline descriptor.
/// - error: On return, if the method fails, a pointer to an error information instance; otherwise `nil`.
///
/// - Returns: A compute pipeline state if the method succeeds, otherwise `nil`.
#[unsafe(method(newComputePipelineStateWithDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newComputePipelineStateWithDescriptor_error(
&self,
descriptor: &MTL4ComputePipelineDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
#[cfg(all(
feature = "MTL4ComputePipeline",
feature = "MTL4LinkingDescriptor",
feature = "MTL4PipelineState",
feature = "MTLAllocation",
feature = "MTLComputePipeline"
))]
/// Creates a compute pipeline state from the archive with a compute descriptor and a dynamic linking descriptor.
///
/// - Parameters:
/// - descriptor: A compute pipeline descriptor.
/// - dynamicLinkingDescriptor: A descriptor that provides additional properties
/// to link other functions with the pipeline.
/// - error: On return, if the method fails, a pointer to an error information instance; otherwise `nil`.
///
/// - Returns: A compute pipeline state if the method succeeds, otherwise `nil`.
#[unsafe(method(newComputePipelineStateWithDescriptor:dynamicLinkingDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newComputePipelineStateWithDescriptor_dynamicLinkingDescriptor_error(
&self,
descriptor: &MTL4ComputePipelineDescriptor,
dynamic_linking_descriptor: &MTL4PipelineStageDynamicLinkingDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
#[cfg(all(
feature = "MTL4PipelineState",
feature = "MTLAllocation",
feature = "MTLRenderPipeline"
))]
/// Creates a render pipeline state from the archive with a descriptor.
///
/// You create any kind of render pipeline states with this method, including:
/// - Traditional render pipelines
/// - Mesh render pipelines
/// - Tile render pipelines
///
/// - Parameters:
/// - descriptor: A render pipeline descriptor.
/// - error: On return, if the method fails, a pointer to an error information instance; otherwise `nil`.
///
/// - Returns: A render pipeline state if the method succeeds, otherwise `nil`.
#[unsafe(method(newRenderPipelineStateWithDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newRenderPipelineStateWithDescriptor_error(
&self,
descriptor: &MTL4PipelineDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
#[cfg(all(
feature = "MTL4LinkingDescriptor",
feature = "MTL4PipelineState",
feature = "MTLAllocation",
feature = "MTLRenderPipeline"
))]
/// Creates a render pipeline state from the archive with a render descriptor and a dynamic linking descriptor.
///
/// You create any kind of render pipeline states with this method, including:
/// - Traditional render pipelines
/// - Mesh render pipelines
/// - Tile render pipelines
///
/// - Parameters:
/// - descriptor: A render pipeline descriptor.
/// - dynamicLinkingDescriptor: A descriptor that provides additional properties
/// to link other functions with the pipeline.
/// - error: On return, if the method fails, a pointer to an error information instance; otherwise `nil`.
///
/// - Returns: A render pipeline state if the method succeeds, otherwise `nil`.
#[unsafe(method(newRenderPipelineStateWithDescriptor:dynamicLinkingDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newRenderPipelineStateWithDescriptor_dynamicLinkingDescriptor_error(
&self,
descriptor: &MTL4PipelineDescriptor,
dynamic_linking_descriptor: &MTL4RenderPipelineDynamicLinkingDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
#[cfg(all(
feature = "MTL4BinaryFunction",
feature = "MTL4BinaryFunctionDescriptor"
))]
/// Method used to create a binary function, with a given descriptor, from the contents of the archive.
/// - Parameters:
/// - descriptor: the function descriptor for a visible or intersection function.
/// - error: an optional parameter that is populated in the case of an error.
/// - Returns: a binary function object, otherwise `nil`.
#[unsafe(method(newBinaryFunctionWithDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newBinaryFunctionWithDescriptor_error(
&self,
descriptor: &MTL4BinaryFunctionDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTL4BinaryFunction>>, Retained<NSError>>;
}
);