Source code
Revision control
Copy as Markdown
Other Tools
//! 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>>;
}
);