use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLStitchedLibraryOptions(pub NSUInteger);
bitflags::bitflags! {
impl MTLStitchedLibraryOptions: NSUInteger {
#[doc(alias = "MTLStitchedLibraryOptionNone")]
const None = 0;
#[doc(alias = "MTLStitchedLibraryOptionFailOnBinaryArchiveMiss")]
const FailOnBinaryArchiveMiss = 1<<0;
#[doc(alias = "MTLStitchedLibraryOptionStoreLibraryInMetalPipelinesScript")]
const StoreLibraryInMetalPipelinesScript = 1<<1;
}
}
unsafe impl Encode for MTLStitchedLibraryOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLStitchedLibraryOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLFunctionStitchingAttribute: NSObjectProtocol {}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingAttributeAlwaysInline;
);
extern_conformance!(
unsafe impl MTLFunctionStitchingAttribute for MTLFunctionStitchingAttributeAlwaysInline {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionStitchingAttributeAlwaysInline {}
);
impl MTLFunctionStitchingAttributeAlwaysInline {
extern_methods!();
}
impl MTLFunctionStitchingAttributeAlwaysInline {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLFunctionStitchingAttributeAlwaysInline {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait MTLFunctionStitchingNode: NSObjectProtocol + NSCopying {}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingInputNode;
);
extern_conformance!(
unsafe impl MTLFunctionStitchingNode for MTLFunctionStitchingInputNode {}
);
extern_conformance!(
unsafe impl NSCopying for MTLFunctionStitchingInputNode {}
);
unsafe impl CopyingHelper for MTLFunctionStitchingInputNode {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionStitchingInputNode {}
);
impl MTLFunctionStitchingInputNode {
extern_methods!(
#[unsafe(method(argumentIndex))]
#[unsafe(method_family = none)]
pub fn argumentIndex(&self) -> NSUInteger;
#[unsafe(method(setArgumentIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn setArgumentIndex(&self, argument_index: NSUInteger);
#[unsafe(method(initWithArgumentIndex:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithArgumentIndex(
this: Allocated<Self>,
argument: NSUInteger,
) -> Retained<Self>;
);
}
impl MTLFunctionStitchingInputNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLFunctionStitchingInputNode {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingFunctionNode;
);
extern_conformance!(
unsafe impl MTLFunctionStitchingNode for MTLFunctionStitchingFunctionNode {}
);
extern_conformance!(
unsafe impl NSCopying for MTLFunctionStitchingFunctionNode {}
);
unsafe impl CopyingHelper for MTLFunctionStitchingFunctionNode {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionStitchingFunctionNode {}
);
impl MTLFunctionStitchingFunctionNode {
extern_methods!(
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSString>;
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub fn setName(&self, name: &NSString);
#[unsafe(method(arguments))]
#[unsafe(method_family = none)]
pub fn arguments(&self) -> Retained<NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>>;
#[unsafe(method(setArguments:))]
#[unsafe(method_family = none)]
pub fn setArguments(
&self,
arguments: &NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>,
);
#[unsafe(method(controlDependencies))]
#[unsafe(method_family = none)]
pub fn controlDependencies(&self) -> Retained<NSArray<MTLFunctionStitchingFunctionNode>>;
#[unsafe(method(setControlDependencies:))]
#[unsafe(method_family = none)]
pub fn setControlDependencies(
&self,
control_dependencies: &NSArray<MTLFunctionStitchingFunctionNode>,
);
#[unsafe(method(initWithName:arguments:controlDependencies:))]
#[unsafe(method_family = init)]
pub fn initWithName_arguments_controlDependencies(
this: Allocated<Self>,
name: &NSString,
arguments: &NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>,
control_dependencies: &NSArray<MTLFunctionStitchingFunctionNode>,
) -> Retained<Self>;
);
}
impl MTLFunctionStitchingFunctionNode {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLFunctionStitchingFunctionNode {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingGraph;
);
extern_conformance!(
unsafe impl NSCopying for MTLFunctionStitchingGraph {}
);
unsafe impl CopyingHelper for MTLFunctionStitchingGraph {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionStitchingGraph {}
);
impl MTLFunctionStitchingGraph {
extern_methods!(
#[unsafe(method(functionName))]
#[unsafe(method_family = none)]
pub fn functionName(&self) -> Retained<NSString>;
#[unsafe(method(setFunctionName:))]
#[unsafe(method_family = none)]
pub fn setFunctionName(&self, function_name: &NSString);
#[unsafe(method(nodes))]
#[unsafe(method_family = none)]
pub fn nodes(&self) -> Retained<NSArray<MTLFunctionStitchingFunctionNode>>;
#[unsafe(method(setNodes:))]
#[unsafe(method_family = none)]
pub fn setNodes(&self, nodes: &NSArray<MTLFunctionStitchingFunctionNode>);
#[unsafe(method(outputNode))]
#[unsafe(method_family = none)]
pub fn outputNode(&self) -> Option<Retained<MTLFunctionStitchingFunctionNode>>;
#[unsafe(method(setOutputNode:))]
#[unsafe(method_family = none)]
pub fn setOutputNode(&self, output_node: Option<&MTLFunctionStitchingFunctionNode>);
#[unsafe(method(attributes))]
#[unsafe(method_family = none)]
pub fn attributes(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>>;
#[unsafe(method(setAttributes:))]
#[unsafe(method_family = none)]
pub fn setAttributes(
&self,
attributes: &NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>,
);
#[unsafe(method(initWithFunctionName:nodes:outputNode:attributes:))]
#[unsafe(method_family = init)]
pub fn initWithFunctionName_nodes_outputNode_attributes(
this: Allocated<Self>,
function_name: &NSString,
nodes: &NSArray<MTLFunctionStitchingFunctionNode>,
output_node: Option<&MTLFunctionStitchingFunctionNode>,
attributes: &NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>,
) -> Retained<Self>;
);
}
impl MTLFunctionStitchingGraph {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLFunctionStitchingGraph {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLStitchedLibraryDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLStitchedLibraryDescriptor {}
);
unsafe impl CopyingHelper for MTLStitchedLibraryDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLStitchedLibraryDescriptor {}
);
impl MTLStitchedLibraryDescriptor {
extern_methods!(
#[unsafe(method(functionGraphs))]
#[unsafe(method_family = none)]
pub fn functionGraphs(&self) -> Retained<NSArray<MTLFunctionStitchingGraph>>;
#[unsafe(method(setFunctionGraphs:))]
#[unsafe(method_family = none)]
pub fn setFunctionGraphs(&self, function_graphs: &NSArray<MTLFunctionStitchingGraph>);
#[cfg(feature = "MTLLibrary")]
#[unsafe(method(functions))]
#[unsafe(method_family = none)]
pub fn functions(&self) -> Retained<NSArray<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
#[unsafe(method(setFunctions:))]
#[unsafe(method_family = none)]
pub unsafe fn setFunctions(&self, functions: &NSArray<ProtocolObject<dyn MTLFunction>>);
#[cfg(feature = "MTLBinaryArchive")]
#[unsafe(method(binaryArchives))]
#[unsafe(method_family = none)]
pub fn binaryArchives(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>;
#[cfg(feature = "MTLBinaryArchive")]
#[unsafe(method(setBinaryArchives:))]
#[unsafe(method_family = none)]
pub fn setBinaryArchives(
&self,
binary_archives: &NSArray<ProtocolObject<dyn MTLBinaryArchive>>,
);
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub fn options(&self) -> MTLStitchedLibraryOptions;
#[unsafe(method(setOptions:))]
#[unsafe(method_family = none)]
pub fn setOptions(&self, options: MTLStitchedLibraryOptions);
);
}
impl MTLStitchedLibraryDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLStitchedLibraryDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}