use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[cfg(feature = "MTLRenderPipeline")]
pub type MTLAutoreleasedRenderPipelineReflection = MTLRenderPipelineReflection;
#[cfg(feature = "MTLComputePipeline")]
pub type MTLAutoreleasedComputePipelineReflection = MTLComputePipelineReflection;
#[cfg(feature = "block2")]
pub type MTLNewLibraryCompletionHandler =
*mut block2::DynBlock<dyn Fn(*mut ProtocolObject<dyn MTLLibrary>, *mut NSError)>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLRenderPipeline",
feature = "block2"
))]
pub type MTLNewRenderPipelineStateCompletionHandler =
*mut block2::DynBlock<dyn Fn(*mut ProtocolObject<dyn MTLRenderPipelineState>, *mut NSError)>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLRenderPipeline",
feature = "block2"
))]
pub type MTLNewRenderPipelineStateWithReflectionCompletionHandler = *mut block2::DynBlock<
dyn Fn(
*mut ProtocolObject<dyn MTLRenderPipelineState>,
*mut MTLRenderPipelineReflection,
*mut NSError,
),
>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLComputePipeline",
feature = "block2"
))]
pub type MTLNewComputePipelineStateCompletionHandler =
*mut block2::DynBlock<dyn Fn(*mut ProtocolObject<dyn MTLComputePipelineState>, *mut NSError)>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLComputePipeline",
feature = "block2"
))]
pub type MTLNewComputePipelineStateWithReflectionCompletionHandler = *mut block2::DynBlock<
dyn Fn(
*mut ProtocolObject<dyn MTLComputePipelineState>,
*mut MTLComputePipelineReflection,
*mut NSError,
),
>;
#[cfg(all(feature = "MTLDynamicLibrary", feature = "block2"))]
pub type MTLNewDynamicLibraryCompletionHandler =
*mut block2::DynBlock<dyn Fn(*mut ProtocolObject<dyn MTLDynamicLibrary>, *mut NSError)>;
#[deprecated = "Use MTLBinding and cast to specific Binding (MTLTextureBinding, MTLBufferBinding, .etc) instead"]
#[cfg(feature = "MTLArgument")]
pub type MTLAutoreleasedArgument = MTLArgument;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLPatchType(pub NSUInteger);
impl MTLPatchType {
#[doc(alias = "MTLPatchTypeNone")]
pub const None: Self = Self(0);
#[doc(alias = "MTLPatchTypeTriangle")]
pub const Triangle: Self = Self(1);
#[doc(alias = "MTLPatchTypeQuad")]
pub const Quad: Self = Self(2);
}
unsafe impl Encode for MTLPatchType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLPatchType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexAttribute;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLVertexAttribute {}
);
impl MTLVertexAttribute {
extern_methods!(
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSString>;
#[unsafe(method(attributeIndex))]
#[unsafe(method_family = none)]
pub fn attributeIndex(&self) -> NSUInteger;
#[cfg(feature = "MTLDataType")]
#[unsafe(method(attributeType))]
#[unsafe(method_family = none)]
pub fn attributeType(&self) -> MTLDataType;
#[unsafe(method(isActive))]
#[unsafe(method_family = none)]
pub fn isActive(&self) -> bool;
#[unsafe(method(isPatchData))]
#[unsafe(method_family = none)]
pub fn isPatchData(&self) -> bool;
#[unsafe(method(isPatchControlPointData))]
#[unsafe(method_family = none)]
pub fn isPatchControlPointData(&self) -> bool;
);
}
impl MTLVertexAttribute {
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 MTLVertexAttribute {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAttribute;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLAttribute {}
);
impl MTLAttribute {
extern_methods!(
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSString>;
#[unsafe(method(attributeIndex))]
#[unsafe(method_family = none)]
pub fn attributeIndex(&self) -> NSUInteger;
#[cfg(feature = "MTLDataType")]
#[unsafe(method(attributeType))]
#[unsafe(method_family = none)]
pub fn attributeType(&self) -> MTLDataType;
#[unsafe(method(isActive))]
#[unsafe(method_family = none)]
pub fn isActive(&self) -> bool;
#[unsafe(method(isPatchData))]
#[unsafe(method_family = none)]
pub fn isPatchData(&self) -> bool;
#[unsafe(method(isPatchControlPointData))]
#[unsafe(method_family = none)]
pub fn isPatchControlPointData(&self) -> bool;
);
}
impl MTLAttribute {
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 MTLAttribute {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLFunctionType(pub NSUInteger);
impl MTLFunctionType {
#[doc(alias = "MTLFunctionTypeVertex")]
pub const Vertex: Self = Self(1);
#[doc(alias = "MTLFunctionTypeFragment")]
pub const Fragment: Self = Self(2);
#[doc(alias = "MTLFunctionTypeKernel")]
pub const Kernel: Self = Self(3);
#[doc(alias = "MTLFunctionTypeVisible")]
pub const Visible: Self = Self(5);
#[doc(alias = "MTLFunctionTypeIntersection")]
pub const Intersection: Self = Self(6);
#[doc(alias = "MTLFunctionTypeMesh")]
pub const Mesh: Self = Self(7);
#[doc(alias = "MTLFunctionTypeObject")]
pub const Object: Self = Self(8);
}
unsafe impl Encode for MTLFunctionType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLFunctionType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionConstant;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionConstant {}
);
impl MTLFunctionConstant {
extern_methods!(
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSString>;
#[cfg(feature = "MTLDataType")]
#[unsafe(method(type))]
#[unsafe(method_family = none)]
pub fn r#type(&self) -> MTLDataType;
#[unsafe(method(index))]
#[unsafe(method_family = none)]
pub fn index(&self) -> NSUInteger;
#[unsafe(method(required))]
#[unsafe(method_family = none)]
pub fn required(&self) -> bool;
);
}
impl MTLFunctionConstant {
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 MTLFunctionConstant {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait MTLFunction: NSObjectProtocol + Send + Sync {
#[unsafe(method(label))]
#[unsafe(method_family = none)]
fn label(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[unsafe(method(device))]
#[unsafe(method_family = none)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[unsafe(method(functionType))]
#[unsafe(method_family = none)]
fn functionType(&self) -> MTLFunctionType;
#[unsafe(method(patchType))]
#[unsafe(method_family = none)]
fn patchType(&self) -> MTLPatchType;
#[unsafe(method(patchControlPointCount))]
#[unsafe(method_family = none)]
fn patchControlPointCount(&self) -> NSInteger;
#[unsafe(method(vertexAttributes))]
#[unsafe(method_family = none)]
fn vertexAttributes(&self) -> Option<Retained<NSArray<MTLVertexAttribute>>>;
#[unsafe(method(stageInputAttributes))]
#[unsafe(method_family = none)]
fn stageInputAttributes(&self) -> Option<Retained<NSArray<MTLAttribute>>>;
#[unsafe(method(name))]
#[unsafe(method_family = none)]
fn name(&self) -> Retained<NSString>;
#[unsafe(method(functionConstantsDictionary))]
#[unsafe(method_family = none)]
fn functionConstantsDictionary(
&self,
) -> Retained<NSDictionary<NSString, MTLFunctionConstant>>;
#[cfg(feature = "MTLArgumentEncoder")]
#[unsafe(method(newArgumentEncoderWithBufferIndex:))]
#[unsafe(method_family = new)]
unsafe fn newArgumentEncoderWithBufferIndex(
&self,
buffer_index: NSUInteger,
) -> Retained<ProtocolObject<dyn MTLArgumentEncoder>>;
#[cfg(all(feature = "MTLArgument", feature = "MTLArgumentEncoder"))]
#[deprecated = "Use MTLDevice's newArgumentEncoderWithBufferBinding: instead"]
#[unsafe(method(newArgumentEncoderWithBufferIndex:reflection:))]
#[unsafe(method_family = new)]
unsafe fn newArgumentEncoderWithBufferIndex_reflection(
&self,
buffer_index: NSUInteger,
reflection: Option<&mut Option<Retained<MTLAutoreleasedArgument>>>,
) -> Retained<ProtocolObject<dyn MTLArgumentEncoder>>;
#[cfg(feature = "MTLFunctionDescriptor")]
#[unsafe(method(options))]
#[unsafe(method_family = none)]
fn options(&self) -> MTLFunctionOptions;
}
);
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLLanguageVersion(pub NSUInteger);
impl MTLLanguageVersion {
#[doc(alias = "MTLLanguageVersion1_0")]
#[deprecated = "Use a newer language standard"]
pub const Version1_0: Self = Self(1 << 16);
#[doc(alias = "MTLLanguageVersion1_1")]
pub const Version1_1: Self = Self((1 << 16) + 1);
#[doc(alias = "MTLLanguageVersion1_2")]
pub const Version1_2: Self = Self((1 << 16) + 2);
#[doc(alias = "MTLLanguageVersion2_0")]
pub const Version2_0: Self = Self(2 << 16);
#[doc(alias = "MTLLanguageVersion2_1")]
pub const Version2_1: Self = Self((2 << 16) + 1);
#[doc(alias = "MTLLanguageVersion2_2")]
pub const Version2_2: Self = Self((2 << 16) + 2);
#[doc(alias = "MTLLanguageVersion2_3")]
pub const Version2_3: Self = Self((2 << 16) + 3);
#[doc(alias = "MTLLanguageVersion2_4")]
pub const Version2_4: Self = Self((2 << 16) + 4);
#[doc(alias = "MTLLanguageVersion3_0")]
pub const Version3_0: Self = Self((3 << 16) + 0);
#[doc(alias = "MTLLanguageVersion3_1")]
pub const Version3_1: Self = Self((3 << 16) + 1);
#[doc(alias = "MTLLanguageVersion3_2")]
pub const Version3_2: Self = Self((3 << 16) + 2);
#[doc(alias = "MTLLanguageVersion4_0")]
pub const Version4_0: Self = Self((4 << 16) + 0);
}
unsafe impl Encode for MTLLanguageVersion {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLLanguageVersion {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLLibraryType(pub NSInteger);
impl MTLLibraryType {
#[doc(alias = "MTLLibraryTypeExecutable")]
pub const Executable: Self = Self(0);
#[doc(alias = "MTLLibraryTypeDynamic")]
pub const Dynamic: Self = Self(1);
}
unsafe impl Encode for MTLLibraryType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLLibraryType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLLibraryOptimizationLevel(pub NSInteger);
impl MTLLibraryOptimizationLevel {
#[doc(alias = "MTLLibraryOptimizationLevelDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "MTLLibraryOptimizationLevelSize")]
pub const Size: Self = Self(1);
}
unsafe impl Encode for MTLLibraryOptimizationLevel {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLLibraryOptimizationLevel {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCompileSymbolVisibility(pub NSInteger);
impl MTLCompileSymbolVisibility {
#[doc(alias = "MTLCompileSymbolVisibilityDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "MTLCompileSymbolVisibilityHidden")]
pub const Hidden: Self = Self(1);
}
unsafe impl Encode for MTLCompileSymbolVisibility {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLCompileSymbolVisibility {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLMathMode(pub NSInteger);
impl MTLMathMode {
#[doc(alias = "MTLMathModeSafe")]
pub const Safe: Self = Self(0);
#[doc(alias = "MTLMathModeRelaxed")]
pub const Relaxed: Self = Self(1);
#[doc(alias = "MTLMathModeFast")]
pub const Fast: Self = Self(2);
}
unsafe impl Encode for MTLMathMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLMathMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLMathFloatingPointFunctions(pub NSInteger);
impl MTLMathFloatingPointFunctions {
#[doc(alias = "MTLMathFloatingPointFunctionsFast")]
pub const Fast: Self = Self(0);
#[doc(alias = "MTLMathFloatingPointFunctionsPrecise")]
pub const Precise: Self = Self(1);
}
unsafe impl Encode for MTLMathFloatingPointFunctions {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLMathFloatingPointFunctions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLCompileOptions;
);
extern_conformance!(
unsafe impl NSCopying for MTLCompileOptions {}
);
unsafe impl CopyingHelper for MTLCompileOptions {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLCompileOptions {}
);
impl MTLCompileOptions {
extern_methods!(
#[unsafe(method(preprocessorMacros))]
#[unsafe(method_family = none)]
pub fn preprocessorMacros(&self) -> Option<Retained<NSDictionary<NSString, NSObject>>>;
#[unsafe(method(setPreprocessorMacros:))]
#[unsafe(method_family = none)]
pub unsafe fn setPreprocessorMacros(
&self,
preprocessor_macros: Option<&NSDictionary<NSString, NSObject>>,
);
#[deprecated = "Use mathMode instead"]
#[unsafe(method(fastMathEnabled))]
#[unsafe(method_family = none)]
pub fn fastMathEnabled(&self) -> bool;
#[deprecated = "Use mathMode instead"]
#[unsafe(method(setFastMathEnabled:))]
#[unsafe(method_family = none)]
pub fn setFastMathEnabled(&self, fast_math_enabled: bool);
#[unsafe(method(mathMode))]
#[unsafe(method_family = none)]
pub fn mathMode(&self) -> MTLMathMode;
#[unsafe(method(setMathMode:))]
#[unsafe(method_family = none)]
pub fn setMathMode(&self, math_mode: MTLMathMode);
#[unsafe(method(mathFloatingPointFunctions))]
#[unsafe(method_family = none)]
pub fn mathFloatingPointFunctions(&self) -> MTLMathFloatingPointFunctions;
#[unsafe(method(setMathFloatingPointFunctions:))]
#[unsafe(method_family = none)]
pub fn setMathFloatingPointFunctions(
&self,
math_floating_point_functions: MTLMathFloatingPointFunctions,
);
#[unsafe(method(languageVersion))]
#[unsafe(method_family = none)]
pub fn languageVersion(&self) -> MTLLanguageVersion;
#[unsafe(method(setLanguageVersion:))]
#[unsafe(method_family = none)]
pub fn setLanguageVersion(&self, language_version: MTLLanguageVersion);
#[unsafe(method(libraryType))]
#[unsafe(method_family = none)]
pub fn libraryType(&self) -> MTLLibraryType;
#[unsafe(method(setLibraryType:))]
#[unsafe(method_family = none)]
pub fn setLibraryType(&self, library_type: MTLLibraryType);
#[unsafe(method(installName))]
#[unsafe(method_family = none)]
pub fn installName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setInstallName:))]
#[unsafe(method_family = none)]
pub fn setInstallName(&self, install_name: Option<&NSString>);
#[cfg(feature = "MTLDynamicLibrary")]
#[unsafe(method(libraries))]
#[unsafe(method_family = none)]
pub fn libraries(&self)
-> Option<Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>>;
#[cfg(feature = "MTLDynamicLibrary")]
#[unsafe(method(setLibraries:))]
#[unsafe(method_family = none)]
pub fn setLibraries(
&self,
libraries: Option<&NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>,
);
#[unsafe(method(preserveInvariance))]
#[unsafe(method_family = none)]
pub fn preserveInvariance(&self) -> bool;
#[unsafe(method(setPreserveInvariance:))]
#[unsafe(method_family = none)]
pub fn setPreserveInvariance(&self, preserve_invariance: bool);
#[unsafe(method(optimizationLevel))]
#[unsafe(method_family = none)]
pub fn optimizationLevel(&self) -> MTLLibraryOptimizationLevel;
#[unsafe(method(setOptimizationLevel:))]
#[unsafe(method_family = none)]
pub fn setOptimizationLevel(&self, optimization_level: MTLLibraryOptimizationLevel);
#[unsafe(method(compileSymbolVisibility))]
#[unsafe(method_family = none)]
pub fn compileSymbolVisibility(&self) -> MTLCompileSymbolVisibility;
#[unsafe(method(setCompileSymbolVisibility:))]
#[unsafe(method_family = none)]
pub fn setCompileSymbolVisibility(
&self,
compile_symbol_visibility: MTLCompileSymbolVisibility,
);
#[unsafe(method(allowReferencingUndefinedSymbols))]
#[unsafe(method_family = none)]
pub fn allowReferencingUndefinedSymbols(&self) -> bool;
#[unsafe(method(setAllowReferencingUndefinedSymbols:))]
#[unsafe(method_family = none)]
pub fn setAllowReferencingUndefinedSymbols(
&self,
allow_referencing_undefined_symbols: bool,
);
#[unsafe(method(maxTotalThreadsPerThreadgroup))]
#[unsafe(method_family = none)]
pub fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
#[unsafe(method(setMaxTotalThreadsPerThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setMaxTotalThreadsPerThreadgroup(
&self,
max_total_threads_per_threadgroup: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[unsafe(method(requiredThreadsPerThreadgroup))]
#[unsafe(method_family = none)]
pub fn requiredThreadsPerThreadgroup(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
#[unsafe(method(setRequiredThreadsPerThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setRequiredThreadsPerThreadgroup(&self, required_threads_per_threadgroup: MTLSize);
#[unsafe(method(enableLogging))]
#[unsafe(method_family = none)]
pub fn enableLogging(&self) -> bool;
#[unsafe(method(setEnableLogging:))]
#[unsafe(method_family = none)]
pub fn setEnableLogging(&self, enable_logging: bool);
);
}
impl MTLCompileOptions {
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 MTLCompileOptions {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionReflection;
);
unsafe impl Send for MTLFunctionReflection {}
unsafe impl Sync for MTLFunctionReflection {}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionReflection {}
);
impl MTLFunctionReflection {
extern_methods!(
#[cfg(feature = "MTLArgument")]
#[unsafe(method(bindings))]
#[unsafe(method_family = none)]
pub fn bindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
);
}
impl MTLFunctionReflection {
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 MTLFunctionReflection {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern "C" {
pub static MTLLibraryErrorDomain: &'static NSErrorDomain;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLLibraryError(pub NSUInteger);
impl MTLLibraryError {
#[doc(alias = "MTLLibraryErrorUnsupported")]
pub const Unsupported: Self = Self(1);
#[doc(alias = "MTLLibraryErrorInternal")]
pub const Internal: Self = Self(2);
#[doc(alias = "MTLLibraryErrorCompileFailure")]
pub const CompileFailure: Self = Self(3);
#[doc(alias = "MTLLibraryErrorCompileWarning")]
pub const CompileWarning: Self = Self(4);
#[doc(alias = "MTLLibraryErrorFunctionNotFound")]
pub const FunctionNotFound: Self = Self(5);
#[doc(alias = "MTLLibraryErrorFileNotFound")]
pub const FileNotFound: Self = Self(6);
}
unsafe impl Encode for MTLLibraryError {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLLibraryError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLLibrary: NSObjectProtocol + Send + Sync {
#[unsafe(method(label))]
#[unsafe(method_family = none)]
fn label(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[unsafe(method(device))]
#[unsafe(method_family = none)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[unsafe(method(newFunctionWithName:))]
#[unsafe(method_family = new)]
fn newFunctionWithName(
&self,
function_name: &NSString,
) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLFunctionConstantValues")]
#[unsafe(method(newFunctionWithName:constantValues:error:_))]
#[unsafe(method_family = new)]
fn newFunctionWithName_constantValues_error(
&self,
name: &NSString,
constant_values: &MTLFunctionConstantValues,
) -> Result<Retained<ProtocolObject<dyn MTLFunction>>, Retained<NSError>>;
#[cfg(all(feature = "MTLFunctionConstantValues", feature = "block2"))]
#[unsafe(method(newFunctionWithName:constantValues:completionHandler:))]
#[unsafe(method_family = none)]
fn newFunctionWithName_constantValues_completionHandler(
&self,
name: &NSString,
constant_values: &MTLFunctionConstantValues,
completion_handler: &block2::DynBlock<
dyn Fn(*mut ProtocolObject<dyn MTLFunction>, *mut NSError),
>,
);
#[unsafe(method(reflectionForFunctionWithName:))]
#[unsafe(method_family = none)]
fn reflectionForFunctionWithName(
&self,
function_name: &NSString,
) -> Option<Retained<MTLFunctionReflection>>;
#[cfg(all(feature = "MTLFunctionDescriptor", feature = "block2"))]
#[unsafe(method(newFunctionWithDescriptor:completionHandler:))]
#[unsafe(method_family = none)]
fn newFunctionWithDescriptor_completionHandler(
&self,
descriptor: &MTLFunctionDescriptor,
completion_handler: &block2::DynBlock<
dyn Fn(*mut ProtocolObject<dyn MTLFunction>, *mut NSError),
>,
);
#[cfg(feature = "MTLFunctionDescriptor")]
#[unsafe(method(newFunctionWithDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newFunctionWithDescriptor_error(
&self,
descriptor: &MTLFunctionDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLFunction>>, Retained<NSError>>;
#[cfg(all(feature = "MTLFunctionDescriptor", feature = "block2"))]
#[unsafe(method(newIntersectionFunctionWithDescriptor:completionHandler:))]
#[unsafe(method_family = none)]
fn newIntersectionFunctionWithDescriptor_completionHandler(
&self,
descriptor: &MTLIntersectionFunctionDescriptor,
completion_handler: &block2::DynBlock<
dyn Fn(*mut ProtocolObject<dyn MTLFunction>, *mut NSError),
>,
);
#[cfg(feature = "MTLFunctionDescriptor")]
#[unsafe(method(newIntersectionFunctionWithDescriptor:error:_))]
#[unsafe(method_family = new)]
fn newIntersectionFunctionWithDescriptor_error(
&self,
descriptor: &MTLIntersectionFunctionDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLFunction>>, Retained<NSError>>;
#[unsafe(method(functionNames))]
#[unsafe(method_family = none)]
fn functionNames(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(type))]
#[unsafe(method_family = none)]
fn r#type(&self) -> MTLLibraryType;
#[unsafe(method(installName))]
#[unsafe(method_family = none)]
fn installName(&self) -> Option<Retained<NSString>>;
}
);