Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

32
vendor/objc2-metal/src/capture.rs vendored Normal file
View File

@@ -0,0 +1,32 @@
#![allow(unused_imports)]
use crate::*;
use objc2::runtime::{AnyObject, ProtocolObject};
// SAFETY: The documentation for captureObject specifies that the object
// may be one of these three:
// <https://developer.apple.com/documentation/metal/mtlcapturedescriptor/3237248-captureobject?language=objc>
impl MTLCaptureDescriptor {
#[doc(alias = "setCaptureObject")]
#[cfg(feature = "MTLDevice")]
pub fn set_capture_device(&self, device: &ProtocolObject<dyn MTLDevice>) {
let device: *const _ = device;
let device: *const AnyObject = device.cast();
unsafe { self.setCaptureObject(Some(&*device)) }
}
#[doc(alias = "setCaptureObject")]
#[cfg(feature = "MTLCaptureScope")]
pub fn set_capture_scope(&self, scope: &ProtocolObject<dyn MTLCaptureScope>) {
let scope: *const _ = scope;
let scope: *const AnyObject = scope.cast();
unsafe { self.setCaptureObject(Some(&*scope)) }
}
#[doc(alias = "setCaptureObject")]
#[cfg(feature = "MTLCommandQueue")]
pub fn set_capture_command_queue(&self, command_queue: &ProtocolObject<dyn MTLCommandQueue>) {
let command_queue: *const _ = command_queue;
let command_queue: *const AnyObject = command_queue.cast();
unsafe { self.setCaptureObject(Some(&*command_queue)) }
}
}

5
vendor/objc2-metal/src/counters.rs vendored Normal file
View File

@@ -0,0 +1,5 @@
#![allow(non_upper_case_globals)]
use objc2::ffi::NSUInteger;
pub const MTLCounterErrorValue: u64 = !0;
pub const MTLCounterDontSample: NSUInteger = (-1isize) as NSUInteger;

17
vendor/objc2-metal/src/device.rs vendored Normal file
View File

@@ -0,0 +1,17 @@
#![cfg(commented_out)]
use crate::MTLDevice;
pub trait MTLDeviceExtension {
// pub fn system_default() -> Option<Self> {
// MTLCreateSystemDefaultDevice()
// }
//
// pub fn all() -> Retained<NSArray<Self>> {
// #[cfg(target_os = "macos")]
// MTLCopyAllDevices()
// #[cfg(not(target_os = "macos"))]
// NSArray::from(MTLCreateSystemDefaultDevice())
// }
}
impl<P: MTLDevice> MTLDeviceExtension for P {}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,309 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLAccelerationStructureRefitOptions(pub NSUInteger);
bitflags::bitflags! {
impl MTLAccelerationStructureRefitOptions: NSUInteger {
const MTLAccelerationStructureRefitOptionVertexData = 1<<0;
const MTLAccelerationStructureRefitOptionPerPrimitiveData = 1<<1;
}
}
unsafe impl Encode for MTLAccelerationStructureRefitOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLAccelerationStructureRefitOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
#[cfg(feature = "MTLCommandEncoder")]
pub unsafe trait MTLAccelerationStructureCommandEncoder:
MTLCommandEncoder + IsRetainable
{
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLBuffer",
feature = "MTLResource"
))]
#[method(buildAccelerationStructure:descriptor:scratchBuffer:scratchBufferOffset:)]
fn buildAccelerationStructure_descriptor_scratchBuffer_scratchBufferOffset(
&self,
acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
descriptor: &MTLAccelerationStructureDescriptor,
scratch_buffer: &ProtocolObject<dyn MTLBuffer>,
scratch_buffer_offset: NSUInteger,
);
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLBuffer",
feature = "MTLResource"
))]
#[method(refitAccelerationStructure:descriptor:destination:scratchBuffer:scratchBufferOffset:)]
unsafe fn refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset(
&self,
source_acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
descriptor: &MTLAccelerationStructureDescriptor,
destination_acceleration_structure: Option<
&ProtocolObject<dyn MTLAccelerationStructure>,
>,
scratch_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
scratch_buffer_offset: NSUInteger,
);
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLBuffer",
feature = "MTLResource"
))]
#[method(refitAccelerationStructure:descriptor:destination:scratchBuffer:scratchBufferOffset:options:)]
unsafe fn refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_options(
&self,
source_acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
descriptor: &MTLAccelerationStructureDescriptor,
destination_acceleration_structure: Option<
&ProtocolObject<dyn MTLAccelerationStructure>,
>,
scratch_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
scratch_buffer_offset: NSUInteger,
options: MTLAccelerationStructureRefitOptions,
);
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method(copyAccelerationStructure:toAccelerationStructure:)]
unsafe fn copyAccelerationStructure_toAccelerationStructure(
&self,
source_acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
destination_acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
);
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLBuffer",
feature = "MTLResource"
))]
#[method(writeCompactedAccelerationStructureSize:toBuffer:offset:)]
fn writeCompactedAccelerationStructureSize_toBuffer_offset(
&self,
acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
);
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLArgument",
feature = "MTLBuffer",
feature = "MTLResource"
))]
#[method(writeCompactedAccelerationStructureSize:toBuffer:offset:sizeDataType:)]
unsafe fn writeCompactedAccelerationStructureSize_toBuffer_offset_sizeDataType(
&self,
acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
size_data_type: MTLDataType,
);
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method(copyAndCompactAccelerationStructure:toAccelerationStructure:)]
fn copyAndCompactAccelerationStructure_toAccelerationStructure(
&self,
source_acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
destination_acceleration_structure: &ProtocolObject<dyn MTLAccelerationStructure>,
);
#[cfg(feature = "MTLFence")]
#[method(updateFence:)]
unsafe fn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(feature = "MTLFence")]
#[method(waitForFence:)]
unsafe fn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(feature = "MTLResource")]
#[method(useResource:usage:)]
unsafe fn useResource_usage(
&self,
resource: &ProtocolObject<dyn MTLResource>,
usage: MTLResourceUsage,
);
#[cfg(feature = "MTLResource")]
#[method(useResources:count:usage:)]
unsafe fn useResources_count_usage(
&self,
resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
count: NSUInteger,
usage: MTLResourceUsage,
);
#[cfg(feature = "MTLHeap")]
#[method(useHeap:)]
unsafe fn useHeap(&self, heap: &ProtocolObject<dyn MTLHeap>);
#[cfg(feature = "MTLHeap")]
#[method(useHeaps:count:)]
unsafe fn useHeaps_count(
&self,
heaps: NonNull<NonNull<ProtocolObject<dyn MTLHeap>>>,
count: NSUInteger,
);
#[cfg(feature = "MTLCounters")]
#[method(sampleCountersInBuffer:atSampleIndex:withBarrier:)]
unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
sample_index: NSUInteger,
barrier: bool,
);
}
#[cfg(feature = "MTLCommandEncoder")]
unsafe impl ProtocolType for dyn MTLAccelerationStructureCommandEncoder {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAccelerationStructurePassSampleBufferAttachmentDescriptor;
unsafe impl ClassType for MTLAccelerationStructurePassSampleBufferAttachmentDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLAccelerationStructurePassSampleBufferAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLAccelerationStructurePassSampleBufferAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLAccelerationStructurePassSampleBufferAttachmentDescriptor {
#[cfg(feature = "MTLCounters")]
#[method_id(@__retain_semantics Other sampleBuffer)]
pub unsafe fn sampleBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
#[cfg(feature = "MTLCounters")]
#[method(setSampleBuffer:)]
pub unsafe fn setSampleBuffer(
&self,
sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
);
#[method(startOfEncoderSampleIndex)]
pub unsafe fn startOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setStartOfEncoderSampleIndex:)]
pub unsafe fn setStartOfEncoderSampleIndex(
&self,
start_of_encoder_sample_index: NSUInteger,
);
#[method(endOfEncoderSampleIndex)]
pub unsafe fn endOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setEndOfEncoderSampleIndex:)]
pub unsafe fn setEndOfEncoderSampleIndex(&self, end_of_encoder_sample_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLAccelerationStructurePassSampleBufferAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray;
unsafe impl ClassType for MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray {}
extern_methods!(
unsafe impl MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLAccelerationStructurePassSampleBufferAttachmentDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLAccelerationStructurePassSampleBufferAttachmentDescriptor>,
attachment_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAccelerationStructurePassDescriptor;
unsafe impl ClassType for MTLAccelerationStructurePassDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLAccelerationStructurePassDescriptor {}
unsafe impl NSObjectProtocol for MTLAccelerationStructurePassDescriptor {}
extern_methods!(
unsafe impl MTLAccelerationStructurePassDescriptor {
#[method_id(@__retain_semantics Other accelerationStructurePassDescriptor)]
pub unsafe fn accelerationStructurePassDescriptor(
) -> Retained<MTLAccelerationStructurePassDescriptor>;
#[method_id(@__retain_semantics Other sampleBufferAttachments)]
pub unsafe fn sampleBufferAttachments(
&self,
) -> Retained<MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLAccelerationStructurePassDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,42 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct _MTLPackedFloat4x3 {
pub columns: [MTLPackedFloat3; 4],
}
unsafe impl Encode for _MTLPackedFloat4x3 {
const ENCODING: Encoding =
Encoding::Struct("_MTLPackedFloat4x3", &[<[MTLPackedFloat3; 4]>::ENCODING]);
}
unsafe impl RefEncode for _MTLPackedFloat4x3 {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type MTLPackedFloat4x3 = _MTLPackedFloat4x3;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct _MTLAxisAlignedBoundingBox {
pub min: MTLPackedFloat3,
pub max: MTLPackedFloat3,
}
unsafe impl Encode for _MTLAxisAlignedBoundingBox {
const ENCODING: Encoding = Encoding::Struct(
"_MTLAxisAlignedBoundingBox",
&[<MTLPackedFloat3>::ENCODING, <MTLPackedFloat3>::ENCODING],
);
}
unsafe impl RefEncode for _MTLAxisAlignedBoundingBox {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type MTLAxisAlignedBoundingBox = _MTLAxisAlignedBoundingBox;

View File

@@ -0,0 +1,754 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLDataType(pub NSUInteger);
impl MTLDataType {
#[doc(alias = "MTLDataTypeNone")]
pub const None: Self = Self(0);
#[doc(alias = "MTLDataTypeStruct")]
pub const Struct: Self = Self(1);
#[doc(alias = "MTLDataTypeArray")]
pub const Array: Self = Self(2);
#[doc(alias = "MTLDataTypeFloat")]
pub const Float: Self = Self(3);
#[doc(alias = "MTLDataTypeFloat2")]
pub const Float2: Self = Self(4);
#[doc(alias = "MTLDataTypeFloat3")]
pub const Float3: Self = Self(5);
#[doc(alias = "MTLDataTypeFloat4")]
pub const Float4: Self = Self(6);
#[doc(alias = "MTLDataTypeFloat2x2")]
pub const Float2x2: Self = Self(7);
#[doc(alias = "MTLDataTypeFloat2x3")]
pub const Float2x3: Self = Self(8);
#[doc(alias = "MTLDataTypeFloat2x4")]
pub const Float2x4: Self = Self(9);
#[doc(alias = "MTLDataTypeFloat3x2")]
pub const Float3x2: Self = Self(10);
#[doc(alias = "MTLDataTypeFloat3x3")]
pub const Float3x3: Self = Self(11);
#[doc(alias = "MTLDataTypeFloat3x4")]
pub const Float3x4: Self = Self(12);
#[doc(alias = "MTLDataTypeFloat4x2")]
pub const Float4x2: Self = Self(13);
#[doc(alias = "MTLDataTypeFloat4x3")]
pub const Float4x3: Self = Self(14);
#[doc(alias = "MTLDataTypeFloat4x4")]
pub const Float4x4: Self = Self(15);
#[doc(alias = "MTLDataTypeHalf")]
pub const Half: Self = Self(16);
#[doc(alias = "MTLDataTypeHalf2")]
pub const Half2: Self = Self(17);
#[doc(alias = "MTLDataTypeHalf3")]
pub const Half3: Self = Self(18);
#[doc(alias = "MTLDataTypeHalf4")]
pub const Half4: Self = Self(19);
#[doc(alias = "MTLDataTypeHalf2x2")]
pub const Half2x2: Self = Self(20);
#[doc(alias = "MTLDataTypeHalf2x3")]
pub const Half2x3: Self = Self(21);
#[doc(alias = "MTLDataTypeHalf2x4")]
pub const Half2x4: Self = Self(22);
#[doc(alias = "MTLDataTypeHalf3x2")]
pub const Half3x2: Self = Self(23);
#[doc(alias = "MTLDataTypeHalf3x3")]
pub const Half3x3: Self = Self(24);
#[doc(alias = "MTLDataTypeHalf3x4")]
pub const Half3x4: Self = Self(25);
#[doc(alias = "MTLDataTypeHalf4x2")]
pub const Half4x2: Self = Self(26);
#[doc(alias = "MTLDataTypeHalf4x3")]
pub const Half4x3: Self = Self(27);
#[doc(alias = "MTLDataTypeHalf4x4")]
pub const Half4x4: Self = Self(28);
#[doc(alias = "MTLDataTypeInt")]
pub const Int: Self = Self(29);
#[doc(alias = "MTLDataTypeInt2")]
pub const Int2: Self = Self(30);
#[doc(alias = "MTLDataTypeInt3")]
pub const Int3: Self = Self(31);
#[doc(alias = "MTLDataTypeInt4")]
pub const Int4: Self = Self(32);
#[doc(alias = "MTLDataTypeUInt")]
pub const UInt: Self = Self(33);
#[doc(alias = "MTLDataTypeUInt2")]
pub const UInt2: Self = Self(34);
#[doc(alias = "MTLDataTypeUInt3")]
pub const UInt3: Self = Self(35);
#[doc(alias = "MTLDataTypeUInt4")]
pub const UInt4: Self = Self(36);
#[doc(alias = "MTLDataTypeShort")]
pub const Short: Self = Self(37);
#[doc(alias = "MTLDataTypeShort2")]
pub const Short2: Self = Self(38);
#[doc(alias = "MTLDataTypeShort3")]
pub const Short3: Self = Self(39);
#[doc(alias = "MTLDataTypeShort4")]
pub const Short4: Self = Self(40);
#[doc(alias = "MTLDataTypeUShort")]
pub const UShort: Self = Self(41);
#[doc(alias = "MTLDataTypeUShort2")]
pub const UShort2: Self = Self(42);
#[doc(alias = "MTLDataTypeUShort3")]
pub const UShort3: Self = Self(43);
#[doc(alias = "MTLDataTypeUShort4")]
pub const UShort4: Self = Self(44);
#[doc(alias = "MTLDataTypeChar")]
pub const Char: Self = Self(45);
#[doc(alias = "MTLDataTypeChar2")]
pub const Char2: Self = Self(46);
#[doc(alias = "MTLDataTypeChar3")]
pub const Char3: Self = Self(47);
#[doc(alias = "MTLDataTypeChar4")]
pub const Char4: Self = Self(48);
#[doc(alias = "MTLDataTypeUChar")]
pub const UChar: Self = Self(49);
#[doc(alias = "MTLDataTypeUChar2")]
pub const UChar2: Self = Self(50);
#[doc(alias = "MTLDataTypeUChar3")]
pub const UChar3: Self = Self(51);
#[doc(alias = "MTLDataTypeUChar4")]
pub const UChar4: Self = Self(52);
#[doc(alias = "MTLDataTypeBool")]
pub const Bool: Self = Self(53);
#[doc(alias = "MTLDataTypeBool2")]
pub const Bool2: Self = Self(54);
#[doc(alias = "MTLDataTypeBool3")]
pub const Bool3: Self = Self(55);
#[doc(alias = "MTLDataTypeBool4")]
pub const Bool4: Self = Self(56);
#[doc(alias = "MTLDataTypeTexture")]
pub const Texture: Self = Self(58);
#[doc(alias = "MTLDataTypeSampler")]
pub const Sampler: Self = Self(59);
#[doc(alias = "MTLDataTypePointer")]
pub const Pointer: Self = Self(60);
#[doc(alias = "MTLDataTypeR8Unorm")]
pub const R8Unorm: Self = Self(62);
#[doc(alias = "MTLDataTypeR8Snorm")]
pub const R8Snorm: Self = Self(63);
#[doc(alias = "MTLDataTypeR16Unorm")]
pub const R16Unorm: Self = Self(64);
#[doc(alias = "MTLDataTypeR16Snorm")]
pub const R16Snorm: Self = Self(65);
#[doc(alias = "MTLDataTypeRG8Unorm")]
pub const RG8Unorm: Self = Self(66);
#[doc(alias = "MTLDataTypeRG8Snorm")]
pub const RG8Snorm: Self = Self(67);
#[doc(alias = "MTLDataTypeRG16Unorm")]
pub const RG16Unorm: Self = Self(68);
#[doc(alias = "MTLDataTypeRG16Snorm")]
pub const RG16Snorm: Self = Self(69);
#[doc(alias = "MTLDataTypeRGBA8Unorm")]
pub const RGBA8Unorm: Self = Self(70);
#[doc(alias = "MTLDataTypeRGBA8Unorm_sRGB")]
pub const RGBA8Unorm_sRGB: Self = Self(71);
#[doc(alias = "MTLDataTypeRGBA8Snorm")]
pub const RGBA8Snorm: Self = Self(72);
#[doc(alias = "MTLDataTypeRGBA16Unorm")]
pub const RGBA16Unorm: Self = Self(73);
#[doc(alias = "MTLDataTypeRGBA16Snorm")]
pub const RGBA16Snorm: Self = Self(74);
#[doc(alias = "MTLDataTypeRGB10A2Unorm")]
pub const RGB10A2Unorm: Self = Self(75);
#[doc(alias = "MTLDataTypeRG11B10Float")]
pub const RG11B10Float: Self = Self(76);
#[doc(alias = "MTLDataTypeRGB9E5Float")]
pub const RGB9E5Float: Self = Self(77);
#[doc(alias = "MTLDataTypeRenderPipeline")]
pub const RenderPipeline: Self = Self(78);
#[doc(alias = "MTLDataTypeComputePipeline")]
pub const ComputePipeline: Self = Self(79);
#[doc(alias = "MTLDataTypeIndirectCommandBuffer")]
pub const IndirectCommandBuffer: Self = Self(80);
#[doc(alias = "MTLDataTypeLong")]
pub const Long: Self = Self(81);
#[doc(alias = "MTLDataTypeLong2")]
pub const Long2: Self = Self(82);
#[doc(alias = "MTLDataTypeLong3")]
pub const Long3: Self = Self(83);
#[doc(alias = "MTLDataTypeLong4")]
pub const Long4: Self = Self(84);
#[doc(alias = "MTLDataTypeULong")]
pub const ULong: Self = Self(85);
#[doc(alias = "MTLDataTypeULong2")]
pub const ULong2: Self = Self(86);
#[doc(alias = "MTLDataTypeULong3")]
pub const ULong3: Self = Self(87);
#[doc(alias = "MTLDataTypeULong4")]
pub const ULong4: Self = Self(88);
#[doc(alias = "MTLDataTypeVisibleFunctionTable")]
pub const VisibleFunctionTable: Self = Self(115);
#[doc(alias = "MTLDataTypeIntersectionFunctionTable")]
pub const IntersectionFunctionTable: Self = Self(116);
#[doc(alias = "MTLDataTypePrimitiveAccelerationStructure")]
pub const PrimitiveAccelerationStructure: Self = Self(117);
#[doc(alias = "MTLDataTypeInstanceAccelerationStructure")]
pub const InstanceAccelerationStructure: Self = Self(118);
#[doc(alias = "MTLDataTypeBFloat")]
pub const BFloat: Self = Self(121);
#[doc(alias = "MTLDataTypeBFloat2")]
pub const BFloat2: Self = Self(122);
#[doc(alias = "MTLDataTypeBFloat3")]
pub const BFloat3: Self = Self(123);
#[doc(alias = "MTLDataTypeBFloat4")]
pub const BFloat4: Self = Self(124);
}
unsafe impl Encode for MTLDataType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLDataType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBindingType(pub NSInteger);
impl MTLBindingType {
#[doc(alias = "MTLBindingTypeBuffer")]
pub const Buffer: Self = Self(0);
#[doc(alias = "MTLBindingTypeThreadgroupMemory")]
pub const ThreadgroupMemory: Self = Self(1);
#[doc(alias = "MTLBindingTypeTexture")]
pub const Texture: Self = Self(2);
#[doc(alias = "MTLBindingTypeSampler")]
pub const Sampler: Self = Self(3);
#[doc(alias = "MTLBindingTypeImageblockData")]
pub const ImageblockData: Self = Self(16);
#[doc(alias = "MTLBindingTypeImageblock")]
pub const Imageblock: Self = Self(17);
#[doc(alias = "MTLBindingTypeVisibleFunctionTable")]
pub const VisibleFunctionTable: Self = Self(24);
#[doc(alias = "MTLBindingTypePrimitiveAccelerationStructure")]
pub const PrimitiveAccelerationStructure: Self = Self(25);
#[doc(alias = "MTLBindingTypeInstanceAccelerationStructure")]
pub const InstanceAccelerationStructure: Self = Self(26);
#[doc(alias = "MTLBindingTypeIntersectionFunctionTable")]
pub const IntersectionFunctionTable: Self = Self(27);
#[doc(alias = "MTLBindingTypeObjectPayload")]
pub const ObjectPayload: Self = Self(34);
}
unsafe impl Encode for MTLBindingType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLBindingType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[deprecated]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLArgumentType(pub NSUInteger);
impl MTLArgumentType {
#[deprecated]
#[doc(alias = "MTLArgumentTypeBuffer")]
pub const Buffer: Self = Self(0);
#[deprecated]
#[doc(alias = "MTLArgumentTypeThreadgroupMemory")]
pub const ThreadgroupMemory: Self = Self(1);
#[deprecated]
#[doc(alias = "MTLArgumentTypeTexture")]
pub const Texture: Self = Self(2);
#[deprecated]
#[doc(alias = "MTLArgumentTypeSampler")]
pub const Sampler: Self = Self(3);
#[doc(alias = "MTLArgumentTypeImageblockData")]
pub const ImageblockData: Self = Self(16);
#[doc(alias = "MTLArgumentTypeImageblock")]
pub const Imageblock: Self = Self(17);
#[doc(alias = "MTLArgumentTypeVisibleFunctionTable")]
pub const VisibleFunctionTable: Self = Self(24);
#[doc(alias = "MTLArgumentTypePrimitiveAccelerationStructure")]
pub const PrimitiveAccelerationStructure: Self = Self(25);
#[doc(alias = "MTLArgumentTypeInstanceAccelerationStructure")]
pub const InstanceAccelerationStructure: Self = Self(26);
#[doc(alias = "MTLArgumentTypeIntersectionFunctionTable")]
pub const IntersectionFunctionTable: Self = Self(27);
}
unsafe impl Encode for MTLArgumentType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLArgumentType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBindingAccess(pub NSUInteger);
impl MTLBindingAccess {
#[doc(alias = "MTLBindingAccessReadOnly")]
pub const ReadOnly: Self = Self(0);
#[doc(alias = "MTLBindingAccessReadWrite")]
pub const ReadWrite: Self = Self(1);
#[doc(alias = "MTLBindingAccessWriteOnly")]
pub const WriteOnly: Self = Self(2);
#[deprecated]
pub const MTLArgumentAccessReadOnly: Self = Self(MTLBindingAccess::ReadOnly.0);
#[deprecated]
pub const MTLArgumentAccessReadWrite: Self = Self(MTLBindingAccess::ReadWrite.0);
#[deprecated]
pub const MTLArgumentAccessWriteOnly: Self = Self(MTLBindingAccess::WriteOnly.0);
}
unsafe impl Encode for MTLBindingAccess {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLBindingAccess {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type MTLArgumentAccess = MTLBindingAccess;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLType;
unsafe impl ClassType for MTLType {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLType {}
extern_methods!(
unsafe impl MTLType {
#[method(dataType)]
pub unsafe fn dataType(&self) -> MTLDataType;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLType {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLStructMember;
unsafe impl ClassType for MTLStructMember {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLStructMember {}
extern_methods!(
unsafe impl MTLStructMember {
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Retained<NSString>;
#[method(offset)]
pub fn offset(&self) -> NSUInteger;
#[method(dataType)]
pub fn dataType(&self) -> MTLDataType;
#[method_id(@__retain_semantics Other structType)]
pub fn structType(&self) -> Option<Retained<MTLStructType>>;
#[method_id(@__retain_semantics Other arrayType)]
pub fn arrayType(&self) -> Option<Retained<MTLArrayType>>;
#[method_id(@__retain_semantics Other textureReferenceType)]
pub unsafe fn textureReferenceType(&self) -> Option<Retained<MTLTextureReferenceType>>;
#[method_id(@__retain_semantics Other pointerType)]
pub unsafe fn pointerType(&self) -> Option<Retained<MTLPointerType>>;
#[method(argumentIndex)]
pub unsafe fn argumentIndex(&self) -> NSUInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLStructMember {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLStructType;
unsafe impl ClassType for MTLStructType {
#[inherits(NSObject)]
type Super = MTLType;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLStructType {}
extern_methods!(
unsafe impl MTLStructType {
#[method_id(@__retain_semantics Other members)]
pub fn members(&self) -> Retained<NSArray<MTLStructMember>>;
#[method_id(@__retain_semantics Other memberByName:)]
pub fn memberByName(&self, name: &NSString) -> Option<Retained<MTLStructMember>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLStructType {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLArrayType;
unsafe impl ClassType for MTLArrayType {
#[inherits(NSObject)]
type Super = MTLType;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLArrayType {}
extern_methods!(
unsafe impl MTLArrayType {
#[method(elementType)]
pub fn elementType(&self) -> MTLDataType;
#[method(arrayLength)]
pub fn arrayLength(&self) -> NSUInteger;
#[method(stride)]
pub fn stride(&self) -> NSUInteger;
#[method(argumentIndexStride)]
pub unsafe fn argumentIndexStride(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other elementStructType)]
pub fn elementStructType(&self) -> Option<Retained<MTLStructType>>;
#[method_id(@__retain_semantics Other elementArrayType)]
pub fn elementArrayType(&self) -> Option<Retained<MTLArrayType>>;
#[method_id(@__retain_semantics Other elementTextureReferenceType)]
pub unsafe fn elementTextureReferenceType(
&self,
) -> Option<Retained<MTLTextureReferenceType>>;
#[method_id(@__retain_semantics Other elementPointerType)]
pub unsafe fn elementPointerType(&self) -> Option<Retained<MTLPointerType>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLArrayType {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLPointerType;
unsafe impl ClassType for MTLPointerType {
#[inherits(NSObject)]
type Super = MTLType;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLPointerType {}
extern_methods!(
unsafe impl MTLPointerType {
#[method(elementType)]
pub unsafe fn elementType(&self) -> MTLDataType;
#[method(access)]
pub unsafe fn access(&self) -> MTLBindingAccess;
#[method(alignment)]
pub unsafe fn alignment(&self) -> NSUInteger;
#[method(dataSize)]
pub unsafe fn dataSize(&self) -> NSUInteger;
#[method(elementIsArgumentBuffer)]
pub unsafe fn elementIsArgumentBuffer(&self) -> bool;
#[method_id(@__retain_semantics Other elementStructType)]
pub unsafe fn elementStructType(&self) -> Option<Retained<MTLStructType>>;
#[method_id(@__retain_semantics Other elementArrayType)]
pub unsafe fn elementArrayType(&self) -> Option<Retained<MTLArrayType>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLPointerType {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLTextureReferenceType;
unsafe impl ClassType for MTLTextureReferenceType {
#[inherits(NSObject)]
type Super = MTLType;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLTextureReferenceType {}
extern_methods!(
unsafe impl MTLTextureReferenceType {
#[method(textureDataType)]
pub unsafe fn textureDataType(&self) -> MTLDataType;
#[cfg(feature = "MTLTexture")]
#[method(textureType)]
pub unsafe fn textureType(&self) -> MTLTextureType;
#[method(access)]
pub unsafe fn access(&self) -> MTLBindingAccess;
#[method(isDepthTexture)]
pub unsafe fn isDepthTexture(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLTextureReferenceType {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct MTLArgument;
unsafe impl ClassType for MTLArgument {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLArgument {}
extern_methods!(
unsafe impl MTLArgument {
#[deprecated]
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Retained<NSString>;
#[deprecated]
#[method(type)]
pub unsafe fn r#type(&self) -> MTLArgumentType;
#[deprecated]
#[method(access)]
pub fn access(&self) -> MTLBindingAccess;
#[deprecated]
#[method(index)]
pub fn index(&self) -> NSUInteger;
#[deprecated]
#[method(isActive)]
pub fn isActive(&self) -> bool;
#[deprecated]
#[method(bufferAlignment)]
pub fn bufferAlignment(&self) -> NSUInteger;
#[deprecated]
#[method(bufferDataSize)]
pub fn bufferDataSize(&self) -> NSUInteger;
#[deprecated]
#[method(bufferDataType)]
pub fn bufferDataType(&self) -> MTLDataType;
#[deprecated]
#[method_id(@__retain_semantics Other bufferStructType)]
pub fn bufferStructType(&self) -> Option<Retained<MTLStructType>>;
#[method_id(@__retain_semantics Other bufferPointerType)]
pub unsafe fn bufferPointerType(&self) -> Option<Retained<MTLPointerType>>;
#[deprecated]
#[method(threadgroupMemoryAlignment)]
pub fn threadgroupMemoryAlignment(&self) -> NSUInteger;
#[deprecated]
#[method(threadgroupMemoryDataSize)]
pub fn threadgroupMemoryDataSize(&self) -> NSUInteger;
#[cfg(feature = "MTLTexture")]
#[deprecated]
#[method(textureType)]
pub fn textureType(&self) -> MTLTextureType;
#[deprecated]
#[method(textureDataType)]
pub fn textureDataType(&self) -> MTLDataType;
#[method(isDepthTexture)]
pub unsafe fn isDepthTexture(&self) -> bool;
#[method(arrayLength)]
pub unsafe fn arrayLength(&self) -> NSUInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLArgument {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLBinding: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other name)]
unsafe fn name(&self) -> Retained<NSString>;
#[method(type)]
unsafe fn r#type(&self) -> MTLBindingType;
#[method(access)]
unsafe fn access(&self) -> MTLBindingAccess;
#[method(index)]
unsafe fn index(&self) -> NSUInteger;
#[method(isUsed)]
unsafe fn isUsed(&self) -> bool;
#[method(isArgument)]
unsafe fn isArgument(&self) -> bool;
}
unsafe impl ProtocolType for dyn MTLBinding {}
);
extern_protocol!(
pub unsafe trait MTLBufferBinding: MTLBinding + IsRetainable {
#[method(bufferAlignment)]
unsafe fn bufferAlignment(&self) -> NSUInteger;
#[method(bufferDataSize)]
unsafe fn bufferDataSize(&self) -> NSUInteger;
#[method(bufferDataType)]
unsafe fn bufferDataType(&self) -> MTLDataType;
#[method_id(@__retain_semantics Other bufferStructType)]
unsafe fn bufferStructType(&self) -> Option<Retained<MTLStructType>>;
#[method_id(@__retain_semantics Other bufferPointerType)]
unsafe fn bufferPointerType(&self) -> Option<Retained<MTLPointerType>>;
}
unsafe impl ProtocolType for dyn MTLBufferBinding {}
);
extern_protocol!(
pub unsafe trait MTLThreadgroupBinding: MTLBinding + IsRetainable {
#[method(threadgroupMemoryAlignment)]
unsafe fn threadgroupMemoryAlignment(&self) -> NSUInteger;
#[method(threadgroupMemoryDataSize)]
unsafe fn threadgroupMemoryDataSize(&self) -> NSUInteger;
}
unsafe impl ProtocolType for dyn MTLThreadgroupBinding {}
);
extern_protocol!(
pub unsafe trait MTLTextureBinding: MTLBinding + IsRetainable {
#[cfg(feature = "MTLTexture")]
#[method(textureType)]
unsafe fn textureType(&self) -> MTLTextureType;
#[method(textureDataType)]
unsafe fn textureDataType(&self) -> MTLDataType;
#[method(isDepthTexture)]
unsafe fn isDepthTexture(&self) -> bool;
#[method(arrayLength)]
unsafe fn arrayLength(&self) -> NSUInteger;
}
unsafe impl ProtocolType for dyn MTLTextureBinding {}
);
extern_protocol!(
pub unsafe trait MTLObjectPayloadBinding: MTLBinding + IsRetainable {
#[method(objectPayloadAlignment)]
unsafe fn objectPayloadAlignment(&self) -> NSUInteger;
#[method(objectPayloadDataSize)]
unsafe fn objectPayloadDataSize(&self) -> NSUInteger;
}
unsafe impl ProtocolType for dyn MTLObjectPayloadBinding {}
);

View File

@@ -0,0 +1,196 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub static MTLAttributeStrideStatic: NSUInteger = NSUIntegerMax as _;
extern_protocol!(
pub unsafe trait MTLArgumentEncoder: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
unsafe fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
#[method(encodedLength)]
fn encodedLength(&self) -> NSUInteger;
#[method(alignment)]
fn alignment(&self) -> NSUInteger;
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setArgumentBuffer:offset:)]
unsafe fn setArgumentBuffer_offset(
&self,
argument_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
offset: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setArgumentBuffer:startOffset:arrayElement:)]
unsafe fn setArgumentBuffer_startOffset_arrayElement(
&self,
argument_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
start_offset: NSUInteger,
array_element: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setBuffer:offset:atIndex:)]
unsafe fn setBuffer_offset_atIndex(
&self,
buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setBuffers:offsets:withRange:)]
unsafe fn setBuffers_offsets_withRange(
&self,
buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
offsets: NonNull<NSUInteger>,
range: NSRange,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(setTexture:atIndex:)]
unsafe fn setTexture_atIndex(
&self,
texture: Option<&ProtocolObject<dyn MTLTexture>>,
index: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(setTextures:withRange:)]
unsafe fn setTextures_withRange(
&self,
textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
range: NSRange,
);
#[cfg(feature = "MTLSampler")]
#[method(setSamplerState:atIndex:)]
unsafe fn setSamplerState_atIndex(
&self,
sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
index: NSUInteger,
);
#[cfg(feature = "MTLSampler")]
#[method(setSamplerStates:withRange:)]
unsafe fn setSamplerStates_withRange(
&self,
samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
range: NSRange,
);
#[method(constantDataAtIndex:)]
unsafe fn constantDataAtIndex(&self, index: NSUInteger) -> NonNull<c_void>;
#[cfg(feature = "MTLRenderPipeline")]
#[method(setRenderPipelineState:atIndex:)]
unsafe fn setRenderPipelineState_atIndex(
&self,
pipeline: Option<&ProtocolObject<dyn MTLRenderPipelineState>>,
index: NSUInteger,
);
#[cfg(feature = "MTLRenderPipeline")]
#[method(setRenderPipelineStates:withRange:)]
unsafe fn setRenderPipelineStates_withRange(
&self,
pipelines: NonNull<*const ProtocolObject<dyn MTLRenderPipelineState>>,
range: NSRange,
);
#[cfg(feature = "MTLComputePipeline")]
#[method(setComputePipelineState:atIndex:)]
unsafe fn setComputePipelineState_atIndex(
&self,
pipeline: Option<&ProtocolObject<dyn MTLComputePipelineState>>,
index: NSUInteger,
);
#[cfg(feature = "MTLComputePipeline")]
#[method(setComputePipelineStates:withRange:)]
unsafe fn setComputePipelineStates_withRange(
&self,
pipelines: NonNull<*const ProtocolObject<dyn MTLComputePipelineState>>,
range: NSRange,
);
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
#[method(setIndirectCommandBuffer:atIndex:)]
unsafe fn setIndirectCommandBuffer_atIndex(
&self,
indirect_command_buffer: Option<&ProtocolObject<dyn MTLIndirectCommandBuffer>>,
index: NSUInteger,
);
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
#[method(setIndirectCommandBuffers:withRange:)]
unsafe fn setIndirectCommandBuffers_withRange(
&self,
buffers: NonNull<*const ProtocolObject<dyn MTLIndirectCommandBuffer>>,
range: NSRange,
);
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method(setAccelerationStructure:atIndex:)]
unsafe fn setAccelerationStructure_atIndex(
&self,
acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
index: NSUInteger,
);
#[method_id(@__retain_semantics New newArgumentEncoderForBufferAtIndex:)]
unsafe fn newArgumentEncoderForBufferAtIndex(
&self,
index: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLArgumentEncoder>>>;
#[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
#[method(setVisibleFunctionTable:atIndex:)]
unsafe fn setVisibleFunctionTable_atIndex(
&self,
visible_function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
index: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
#[method(setVisibleFunctionTables:withRange:)]
unsafe fn setVisibleFunctionTables_withRange(
&self,
visible_function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
range: NSRange,
);
#[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
#[method(setIntersectionFunctionTable:atIndex:)]
unsafe fn setIntersectionFunctionTable_atIndex(
&self,
intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
index: NSUInteger,
);
#[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
#[method(setIntersectionFunctionTables:withRange:)]
unsafe fn setIntersectionFunctionTables_withRange(
&self,
intersection_function_tables: NonNull<
*const ProtocolObject<dyn MTLIntersectionFunctionTable>,
>,
range: NSRange,
);
}
unsafe impl ProtocolType for dyn MTLArgumentEncoder {}
);

View File

@@ -0,0 +1,125 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static MTLBinaryArchiveDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBinaryArchiveError(pub NSUInteger);
impl MTLBinaryArchiveError {
#[doc(alias = "MTLBinaryArchiveErrorNone")]
pub const None: Self = Self(0);
#[doc(alias = "MTLBinaryArchiveErrorInvalidFile")]
pub const InvalidFile: Self = Self(1);
#[doc(alias = "MTLBinaryArchiveErrorUnexpectedElement")]
pub const UnexpectedElement: Self = Self(2);
#[doc(alias = "MTLBinaryArchiveErrorCompilationFailure")]
pub const CompilationFailure: Self = Self(3);
#[doc(alias = "MTLBinaryArchiveErrorInternalError")]
pub const InternalError: Self = Self(4);
}
unsafe impl Encode for MTLBinaryArchiveError {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLBinaryArchiveError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLBinaryArchiveDescriptor;
unsafe impl ClassType for MTLBinaryArchiveDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLBinaryArchiveDescriptor {}
unsafe impl NSObjectProtocol for MTLBinaryArchiveDescriptor {}
extern_methods!(
unsafe impl MTLBinaryArchiveDescriptor {
#[method_id(@__retain_semantics Other url)]
pub fn url(&self) -> Option<Retained<NSURL>>;
#[method(setUrl:)]
pub fn setUrl(&self, url: Option<&NSURL>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLBinaryArchiveDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLBinaryArchiveDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait MTLBinaryArchive: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[cfg(feature = "MTLComputePipeline")]
#[method(addComputePipelineFunctionsWithDescriptor:error:_)]
fn addComputePipelineFunctionsWithDescriptor_error(
&self,
descriptor: &MTLComputePipelineDescriptor,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "MTLRenderPipeline")]
#[method(addRenderPipelineFunctionsWithDescriptor:error:_)]
fn addRenderPipelineFunctionsWithDescriptor_error(
&self,
descriptor: &MTLRenderPipelineDescriptor,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "MTLRenderPipeline")]
#[method(addTileRenderPipelineFunctionsWithDescriptor:error:_)]
unsafe fn addTileRenderPipelineFunctionsWithDescriptor_error(
&self,
descriptor: &MTLTileRenderPipelineDescriptor,
) -> Result<(), Retained<NSError>>;
#[method(serializeToURL:error:_)]
fn serializeToURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "MTLFunctionDescriptor", feature = "MTLLibrary"))]
#[method(addFunctionWithDescriptor:library:error:_)]
unsafe fn addFunctionWithDescriptor_library_error(
&self,
descriptor: &MTLFunctionDescriptor,
library: &ProtocolObject<dyn MTLLibrary>,
) -> Result<(), Retained<NSError>>;
}
unsafe impl ProtocolType for dyn MTLBinaryArchive {}
);

View File

@@ -0,0 +1,308 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBlitOption(pub NSUInteger);
bitflags::bitflags! {
impl MTLBlitOption: NSUInteger {
#[doc(alias = "MTLBlitOptionNone")]
const None = 0;
#[doc(alias = "MTLBlitOptionDepthFromDepthStencil")]
const DepthFromDepthStencil = 1<<0;
#[doc(alias = "MTLBlitOptionStencilFromDepthStencil")]
const StencilFromDepthStencil = 1<<1;
#[doc(alias = "MTLBlitOptionRowLinearPVRTC")]
const RowLinearPVRTC = 1<<2;
}
}
unsafe impl Encode for MTLBlitOption {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLBlitOption {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
#[cfg(feature = "MTLCommandEncoder")]
pub unsafe trait MTLBlitCommandEncoder: MTLCommandEncoder + IsRetainable {
#[cfg(feature = "MTLResource")]
#[method(synchronizeResource:)]
fn synchronizeResource(&self, resource: &ProtocolObject<dyn MTLResource>);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(synchronizeTexture:slice:level:)]
unsafe fn synchronizeTexture_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture", feature = "MTLTypes"))]
#[method(copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:)]
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))]
#[method(copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:)]
unsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))]
#[method(copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:)]
unsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
options: MTLBlitOption,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))]
#[method(copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:)]
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
destination_bytes_per_row: NSUInteger,
destination_bytes_per_image: NSUInteger,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))]
#[method(copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:options:)]
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
destination_bytes_per_row: NSUInteger,
destination_bytes_per_image: NSUInteger,
options: MTLBlitOption,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(generateMipmapsForTexture:)]
fn generateMipmapsForTexture(&self, texture: &ProtocolObject<dyn MTLTexture>);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(fillBuffer:range:value:)]
fn fillBuffer_range_value(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
range: NSRange,
value: u8,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:)]
unsafe fn copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
slice_count: NSUInteger,
level_count: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(copyFromTexture:toTexture:)]
unsafe fn copyFromTexture_toTexture(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
destination_texture: &ProtocolObject<dyn MTLTexture>,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:)]
unsafe fn copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
size: NSUInteger,
);
#[cfg(feature = "MTLFence")]
#[method(updateFence:)]
fn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(feature = "MTLFence")]
#[method(waitForFence:)]
fn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))]
#[optional]
#[method(getTextureAccessCounters:region:mipLevel:slice:resetCounters:countersBuffer:countersBufferOffset:)]
unsafe fn getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
reset_counters: bool,
counters_buffer: &ProtocolObject<dyn MTLBuffer>,
counters_buffer_offset: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture", feature = "MTLTypes"))]
#[optional]
#[method(resetTextureAccessCounters:region:mipLevel:slice:)]
unsafe fn resetTextureAccessCounters_region_mipLevel_slice(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(optimizeContentsForGPUAccess:)]
fn optimizeContentsForGPUAccess(&self, texture: &ProtocolObject<dyn MTLTexture>);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(optimizeContentsForGPUAccess:slice:level:)]
unsafe fn optimizeContentsForGPUAccess_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(optimizeContentsForCPUAccess:)]
unsafe fn optimizeContentsForCPUAccess(&self, texture: &ProtocolObject<dyn MTLTexture>);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(optimizeContentsForCPUAccess:slice:level:)]
unsafe fn optimizeContentsForCPUAccess_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
);
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
#[method(resetCommandsInBuffer:withRange:)]
unsafe fn resetCommandsInBuffer_withRange(
&self,
buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
range: NSRange,
);
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
#[method(copyIndirectCommandBuffer:sourceRange:destination:destinationIndex:)]
unsafe fn copyIndirectCommandBuffer_sourceRange_destination_destinationIndex(
&self,
source: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
source_range: NSRange,
destination: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
destination_index: NSUInteger,
);
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
#[method(optimizeIndirectCommandBuffer:withRange:)]
unsafe fn optimizeIndirectCommandBuffer_withRange(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
range: NSRange,
);
#[cfg(feature = "MTLCounters")]
#[method(sampleCountersInBuffer:atSampleIndex:withBarrier:)]
unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
sample_index: NSUInteger,
barrier: bool,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLCounters",
feature = "MTLResource"
))]
#[method(resolveCounters:inRange:destinationBuffer:destinationOffset:)]
unsafe fn resolveCounters_inRange_destinationBuffer_destinationOffset(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
range: NSRange,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
);
}
#[cfg(feature = "MTLCommandEncoder")]
unsafe impl ProtocolType for dyn MTLBlitCommandEncoder {}
);

View File

@@ -0,0 +1,140 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLBlitPassSampleBufferAttachmentDescriptor;
unsafe impl ClassType for MTLBlitPassSampleBufferAttachmentDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLBlitPassSampleBufferAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLBlitPassSampleBufferAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLBlitPassSampleBufferAttachmentDescriptor {
#[cfg(feature = "MTLCounters")]
#[method_id(@__retain_semantics Other sampleBuffer)]
pub unsafe fn sampleBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
#[cfg(feature = "MTLCounters")]
#[method(setSampleBuffer:)]
pub unsafe fn setSampleBuffer(
&self,
sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
);
#[method(startOfEncoderSampleIndex)]
pub unsafe fn startOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setStartOfEncoderSampleIndex:)]
pub unsafe fn setStartOfEncoderSampleIndex(
&self,
start_of_encoder_sample_index: NSUInteger,
);
#[method(endOfEncoderSampleIndex)]
pub unsafe fn endOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setEndOfEncoderSampleIndex:)]
pub unsafe fn setEndOfEncoderSampleIndex(&self, end_of_encoder_sample_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLBlitPassSampleBufferAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLBlitPassSampleBufferAttachmentDescriptorArray;
unsafe impl ClassType for MTLBlitPassSampleBufferAttachmentDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLBlitPassSampleBufferAttachmentDescriptorArray {}
extern_methods!(
unsafe impl MTLBlitPassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLBlitPassSampleBufferAttachmentDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLBlitPassSampleBufferAttachmentDescriptor>,
attachment_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLBlitPassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLBlitPassDescriptor;
unsafe impl ClassType for MTLBlitPassDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLBlitPassDescriptor {}
unsafe impl NSObjectProtocol for MTLBlitPassDescriptor {}
extern_methods!(
unsafe impl MTLBlitPassDescriptor {
#[method_id(@__retain_semantics Other blitPassDescriptor)]
pub unsafe fn blitPassDescriptor() -> Retained<MTLBlitPassDescriptor>;
#[method_id(@__retain_semantics Other sampleBufferAttachments)]
pub unsafe fn sampleBufferAttachments(
&self,
) -> Retained<MTLBlitPassSampleBufferAttachmentDescriptorArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLBlitPassDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,51 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
#[cfg(feature = "MTLResource")]
pub unsafe trait MTLBuffer: MTLResource + IsRetainable {
#[method(length)]
fn length(&self) -> NSUInteger;
#[method(contents)]
fn contents(&self) -> NonNull<c_void>;
#[method(didModifyRange:)]
fn didModifyRange(&self, range: NSRange);
#[cfg(feature = "MTLTexture")]
#[method_id(@__retain_semantics New newTextureWithDescriptor:offset:bytesPerRow:)]
fn newTextureWithDescriptor_offset_bytesPerRow(
&self,
descriptor: &MTLTextureDescriptor,
offset: NSUInteger,
bytes_per_row: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[method(addDebugMarker:range:)]
fn addDebugMarker_range(&self, marker: &NSString, range: NSRange);
#[method(removeAllDebugMarkers)]
fn removeAllDebugMarkers(&self);
#[method_id(@__retain_semantics Other remoteStorageBuffer)]
fn remoteStorageBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics New newRemoteBufferViewForDevice:)]
fn newRemoteBufferViewForDevice(
&self,
device: &ProtocolObject<dyn MTLDevice>,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[method(gpuAddress)]
fn gpuAddress(&self) -> u64;
}
#[cfg(feature = "MTLResource")]
unsafe impl ProtocolType for dyn MTLBuffer {}
);

View File

@@ -0,0 +1,192 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static MTLCaptureErrorDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCaptureError(pub NSInteger);
impl MTLCaptureError {
#[doc(alias = "MTLCaptureErrorNotSupported")]
pub const NotSupported: Self = Self(1);
#[doc(alias = "MTLCaptureErrorAlreadyCapturing")]
pub const AlreadyCapturing: Self = Self(2);
#[doc(alias = "MTLCaptureErrorInvalidDescriptor")]
pub const InvalidDescriptor: Self = Self(3);
}
unsafe impl Encode for MTLCaptureError {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLCaptureError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCaptureDestination(pub NSInteger);
impl MTLCaptureDestination {
#[doc(alias = "MTLCaptureDestinationDeveloperTools")]
pub const DeveloperTools: Self = Self(1);
#[doc(alias = "MTLCaptureDestinationGPUTraceDocument")]
pub const GPUTraceDocument: Self = Self(2);
}
unsafe impl Encode for MTLCaptureDestination {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLCaptureDestination {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLCaptureDescriptor;
unsafe impl ClassType for MTLCaptureDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLCaptureDescriptor {}
unsafe impl NSObjectProtocol for MTLCaptureDescriptor {}
extern_methods!(
unsafe impl MTLCaptureDescriptor {
#[method_id(@__retain_semantics Other captureObject)]
pub unsafe fn captureObject(&self) -> Option<Retained<AnyObject>>;
#[method(setCaptureObject:)]
pub unsafe fn setCaptureObject(&self, capture_object: Option<&AnyObject>);
#[method(destination)]
pub fn destination(&self) -> MTLCaptureDestination;
#[method(setDestination:)]
pub fn setDestination(&self, destination: MTLCaptureDestination);
#[method_id(@__retain_semantics Other outputURL)]
pub fn outputURL(&self) -> Option<Retained<NSURL>>;
#[method(setOutputURL:)]
pub fn setOutputURL(&self, output_url: Option<&NSURL>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLCaptureDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLCaptureDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLCaptureManager;
unsafe impl ClassType for MTLCaptureManager {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLCaptureManager {}
extern_methods!(
unsafe impl MTLCaptureManager {
#[method_id(@__retain_semantics Other sharedCaptureManager)]
pub unsafe fn sharedCaptureManager() -> Retained<MTLCaptureManager>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "MTLCaptureScope", feature = "MTLDevice"))]
#[method_id(@__retain_semantics New newCaptureScopeWithDevice:)]
pub fn newCaptureScopeWithDevice(
&self,
device: &ProtocolObject<dyn MTLDevice>,
) -> Retained<ProtocolObject<dyn MTLCaptureScope>>;
#[cfg(all(feature = "MTLCaptureScope", feature = "MTLCommandQueue"))]
#[method_id(@__retain_semantics New newCaptureScopeWithCommandQueue:)]
pub fn newCaptureScopeWithCommandQueue(
&self,
command_queue: &ProtocolObject<dyn MTLCommandQueue>,
) -> Retained<ProtocolObject<dyn MTLCaptureScope>>;
#[method(supportsDestination:)]
pub fn supportsDestination(&self, destination: MTLCaptureDestination) -> bool;
#[method(startCaptureWithDescriptor:error:_)]
pub fn startCaptureWithDescriptor_error(
&self,
descriptor: &MTLCaptureDescriptor,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "MTLDevice")]
#[deprecated = "Use startCaptureWithDescriptor:error: instead"]
#[method(startCaptureWithDevice:)]
pub fn startCaptureWithDevice(&self, device: &ProtocolObject<dyn MTLDevice>);
#[cfg(feature = "MTLCommandQueue")]
#[deprecated = "Use startCaptureWithDescriptor:error: instead"]
#[method(startCaptureWithCommandQueue:)]
pub fn startCaptureWithCommandQueue(
&self,
command_queue: &ProtocolObject<dyn MTLCommandQueue>,
);
#[cfg(feature = "MTLCaptureScope")]
#[deprecated = "Use startCaptureWithDescriptor:error: instead"]
#[method(startCaptureWithScope:)]
pub fn startCaptureWithScope(&self, capture_scope: &ProtocolObject<dyn MTLCaptureScope>);
#[method(stopCapture)]
pub fn stopCapture(&self);
#[cfg(feature = "MTLCaptureScope")]
#[method_id(@__retain_semantics Other defaultCaptureScope)]
pub fn defaultCaptureScope(&self) -> Option<Retained<ProtocolObject<dyn MTLCaptureScope>>>;
#[cfg(feature = "MTLCaptureScope")]
#[method(setDefaultCaptureScope:)]
pub fn setDefaultCaptureScope(
&self,
default_capture_scope: Option<&ProtocolObject<dyn MTLCaptureScope>>,
);
#[method(isCapturing)]
pub fn isCapturing(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLCaptureManager {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,32 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLCaptureScope: NSObjectProtocol + IsRetainable {
#[method(beginScope)]
fn beginScope(&self);
#[method(endScope)]
fn endScope(&self);
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
unsafe fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[cfg(feature = "MTLCommandQueue")]
#[method_id(@__retain_semantics Other commandQueue)]
unsafe fn commandQueue(&self) -> Option<Retained<ProtocolObject<dyn MTLCommandQueue>>>;
}
unsafe impl ProtocolType for dyn MTLCaptureScope {}
);

View File

@@ -0,0 +1,409 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCommandBufferStatus(pub NSUInteger);
impl MTLCommandBufferStatus {
#[doc(alias = "MTLCommandBufferStatusNotEnqueued")]
pub const NotEnqueued: Self = Self(0);
#[doc(alias = "MTLCommandBufferStatusEnqueued")]
pub const Enqueued: Self = Self(1);
#[doc(alias = "MTLCommandBufferStatusCommitted")]
pub const Committed: Self = Self(2);
#[doc(alias = "MTLCommandBufferStatusScheduled")]
pub const Scheduled: Self = Self(3);
#[doc(alias = "MTLCommandBufferStatusCompleted")]
pub const Completed: Self = Self(4);
#[doc(alias = "MTLCommandBufferStatusError")]
pub const Error: Self = Self(5);
}
unsafe impl Encode for MTLCommandBufferStatus {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLCommandBufferStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static MTLCommandBufferErrorDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCommandBufferError(pub NSUInteger);
impl MTLCommandBufferError {
#[doc(alias = "MTLCommandBufferErrorNone")]
pub const None: Self = Self(0);
#[doc(alias = "MTLCommandBufferErrorInternal")]
pub const Internal: Self = Self(1);
#[doc(alias = "MTLCommandBufferErrorTimeout")]
pub const Timeout: Self = Self(2);
#[doc(alias = "MTLCommandBufferErrorPageFault")]
pub const PageFault: Self = Self(3);
#[deprecated]
#[doc(alias = "MTLCommandBufferErrorBlacklisted")]
pub const Blacklisted: Self = Self(4);
#[doc(alias = "MTLCommandBufferErrorAccessRevoked")]
pub const AccessRevoked: Self = Self(4);
#[doc(alias = "MTLCommandBufferErrorNotPermitted")]
pub const NotPermitted: Self = Self(7);
#[doc(alias = "MTLCommandBufferErrorOutOfMemory")]
pub const OutOfMemory: Self = Self(8);
#[doc(alias = "MTLCommandBufferErrorInvalidResource")]
pub const InvalidResource: Self = Self(9);
#[doc(alias = "MTLCommandBufferErrorMemoryless")]
pub const Memoryless: Self = Self(10);
#[doc(alias = "MTLCommandBufferErrorDeviceRemoved")]
pub const DeviceRemoved: Self = Self(11);
#[doc(alias = "MTLCommandBufferErrorStackOverflow")]
pub const StackOverflow: Self = Self(12);
}
unsafe impl Encode for MTLCommandBufferError {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLCommandBufferError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static MTLCommandBufferEncoderInfoErrorKey: &'static NSErrorUserInfoKey;
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCommandBufferErrorOption(pub NSUInteger);
bitflags::bitflags! {
impl MTLCommandBufferErrorOption: NSUInteger {
#[doc(alias = "MTLCommandBufferErrorOptionNone")]
const None = 0;
#[doc(alias = "MTLCommandBufferErrorOptionEncoderExecutionStatus")]
const EncoderExecutionStatus = 1<<0;
}
}
unsafe impl Encode for MTLCommandBufferErrorOption {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLCommandBufferErrorOption {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCommandEncoderErrorState(pub NSInteger);
impl MTLCommandEncoderErrorState {
#[doc(alias = "MTLCommandEncoderErrorStateUnknown")]
pub const Unknown: Self = Self(0);
#[doc(alias = "MTLCommandEncoderErrorStateCompleted")]
pub const Completed: Self = Self(1);
#[doc(alias = "MTLCommandEncoderErrorStateAffected")]
pub const Affected: Self = Self(2);
#[doc(alias = "MTLCommandEncoderErrorStatePending")]
pub const Pending: Self = Self(3);
#[doc(alias = "MTLCommandEncoderErrorStateFaulted")]
pub const Faulted: Self = Self(4);
}
unsafe impl Encode for MTLCommandEncoderErrorState {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLCommandEncoderErrorState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLCommandBufferDescriptor;
unsafe impl ClassType for MTLCommandBufferDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLCommandBufferDescriptor {}
unsafe impl NSObjectProtocol for MTLCommandBufferDescriptor {}
extern_methods!(
unsafe impl MTLCommandBufferDescriptor {
#[method(retainedReferences)]
pub unsafe fn retainedReferences(&self) -> bool;
#[method(setRetainedReferences:)]
pub unsafe fn setRetainedReferences(&self, retained_references: bool);
#[method(errorOptions)]
pub unsafe fn errorOptions(&self) -> MTLCommandBufferErrorOption;
#[method(setErrorOptions:)]
pub unsafe fn setErrorOptions(&self, error_options: MTLCommandBufferErrorOption);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLCommandBufferDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLCommandBufferEncoderInfo: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other debugSignposts)]
unsafe fn debugSignposts(&self) -> Retained<NSArray<NSString>>;
#[method(errorState)]
unsafe fn errorState(&self) -> MTLCommandEncoderErrorState;
}
unsafe impl ProtocolType for dyn MTLCommandBufferEncoderInfo {}
);
#[cfg(feature = "block2")]
pub type MTLCommandBufferHandler =
*mut block2::Block<dyn Fn(NonNull<ProtocolObject<dyn MTLCommandBuffer>>)>;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLDispatchType(pub NSUInteger);
impl MTLDispatchType {
#[doc(alias = "MTLDispatchTypeSerial")]
pub const Serial: Self = Self(0);
#[doc(alias = "MTLDispatchTypeConcurrent")]
pub const Concurrent: Self = Self(1);
}
unsafe impl Encode for MTLDispatchType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLDispatchType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLCommandBuffer: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
unsafe fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[cfg(feature = "MTLCommandQueue")]
#[method_id(@__retain_semantics Other commandQueue)]
unsafe fn commandQueue(&self) -> Retained<ProtocolObject<dyn MTLCommandQueue>>;
#[method(retainedReferences)]
unsafe fn retainedReferences(&self) -> bool;
#[method(errorOptions)]
unsafe fn errorOptions(&self) -> MTLCommandBufferErrorOption;
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[method(kernelStartTime)]
unsafe fn kernelStartTime(&self) -> CFTimeInterval;
#[method(kernelEndTime)]
unsafe fn kernelEndTime(&self) -> CFTimeInterval;
#[cfg(feature = "MTLFunctionLog")]
#[method_id(@__retain_semantics Other logs)]
unsafe fn logs(&self) -> Retained<ProtocolObject<dyn MTLLogContainer>>;
#[method(GPUStartTime)]
unsafe fn GPUStartTime(&self) -> CFTimeInterval;
#[method(GPUEndTime)]
unsafe fn GPUEndTime(&self) -> CFTimeInterval;
#[method(enqueue)]
fn enqueue(&self);
#[method(commit)]
fn commit(&self);
#[cfg(feature = "block2")]
#[method(addScheduledHandler:)]
unsafe fn addScheduledHandler(&self, block: MTLCommandBufferHandler);
#[cfg(feature = "MTLDrawable")]
#[method(presentDrawable:)]
fn presentDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>);
#[cfg(feature = "MTLDrawable")]
#[method(presentDrawable:atTime:)]
unsafe fn presentDrawable_atTime(
&self,
drawable: &ProtocolObject<dyn MTLDrawable>,
presentation_time: CFTimeInterval,
);
#[cfg(feature = "MTLDrawable")]
#[method(presentDrawable:afterMinimumDuration:)]
unsafe fn presentDrawable_afterMinimumDuration(
&self,
drawable: &ProtocolObject<dyn MTLDrawable>,
duration: CFTimeInterval,
);
#[method(waitUntilScheduled)]
fn waitUntilScheduled(&self);
#[cfg(feature = "block2")]
#[method(addCompletedHandler:)]
unsafe fn addCompletedHandler(&self, block: MTLCommandBufferHandler);
#[method(waitUntilCompleted)]
unsafe fn waitUntilCompleted(&self);
#[method(status)]
fn status(&self) -> MTLCommandBufferStatus;
#[method_id(@__retain_semantics Other error)]
unsafe fn error(&self) -> Option<Retained<NSError>>;
#[cfg(all(feature = "MTLBlitCommandEncoder", feature = "MTLCommandEncoder"))]
#[method_id(@__retain_semantics Other blitCommandEncoder)]
fn blitCommandEncoder(&self)
-> Option<Retained<ProtocolObject<dyn MTLBlitCommandEncoder>>>;
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLRenderCommandEncoder",
feature = "MTLRenderPass"
))]
#[method_id(@__retain_semantics Other renderCommandEncoderWithDescriptor:)]
fn renderCommandEncoderWithDescriptor(
&self,
render_pass_descriptor: &MTLRenderPassDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLRenderCommandEncoder>>>;
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLComputeCommandEncoder",
feature = "MTLComputePass"
))]
#[method_id(@__retain_semantics Other computeCommandEncoderWithDescriptor:)]
unsafe fn computeCommandEncoderWithDescriptor(
&self,
compute_pass_descriptor: &MTLComputePassDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLComputeCommandEncoder>>>;
#[cfg(all(
feature = "MTLBlitCommandEncoder",
feature = "MTLBlitPass",
feature = "MTLCommandEncoder"
))]
#[method_id(@__retain_semantics Other blitCommandEncoderWithDescriptor:)]
unsafe fn blitCommandEncoderWithDescriptor(
&self,
blit_pass_descriptor: &MTLBlitPassDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLBlitCommandEncoder>>>;
#[cfg(all(feature = "MTLCommandEncoder", feature = "MTLComputeCommandEncoder"))]
#[method_id(@__retain_semantics Other computeCommandEncoder)]
fn computeCommandEncoder(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLComputeCommandEncoder>>>;
#[cfg(all(feature = "MTLCommandEncoder", feature = "MTLComputeCommandEncoder"))]
#[method_id(@__retain_semantics Other computeCommandEncoderWithDispatchType:)]
fn computeCommandEncoderWithDispatchType(
&self,
dispatch_type: MTLDispatchType,
) -> Option<Retained<ProtocolObject<dyn MTLComputeCommandEncoder>>>;
#[cfg(feature = "MTLEvent")]
#[method(encodeWaitForEvent:value:)]
fn encodeWaitForEvent_value(&self, event: &ProtocolObject<dyn MTLEvent>, value: u64);
#[cfg(feature = "MTLEvent")]
#[method(encodeSignalEvent:value:)]
fn encodeSignalEvent_value(&self, event: &ProtocolObject<dyn MTLEvent>, value: u64);
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLParallelRenderCommandEncoder",
feature = "MTLRenderPass"
))]
#[method_id(@__retain_semantics Other parallelRenderCommandEncoderWithDescriptor:)]
fn parallelRenderCommandEncoderWithDescriptor(
&self,
render_pass_descriptor: &MTLRenderPassDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLParallelRenderCommandEncoder>>>;
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLResourceStateCommandEncoder"
))]
#[method_id(@__retain_semantics Other resourceStateCommandEncoder)]
unsafe fn resourceStateCommandEncoder(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLResourceStateCommandEncoder>>>;
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLResourceStateCommandEncoder",
feature = "MTLResourceStatePass"
))]
#[method_id(@__retain_semantics Other resourceStateCommandEncoderWithDescriptor:)]
unsafe fn resourceStateCommandEncoderWithDescriptor(
&self,
resource_state_pass_descriptor: &MTLResourceStatePassDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLResourceStateCommandEncoder>>>;
#[cfg(all(
feature = "MTLAccelerationStructureCommandEncoder",
feature = "MTLCommandEncoder"
))]
#[method_id(@__retain_semantics Other accelerationStructureCommandEncoder)]
fn accelerationStructureCommandEncoder(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLAccelerationStructureCommandEncoder>>>;
#[cfg(all(
feature = "MTLAccelerationStructureCommandEncoder",
feature = "MTLCommandEncoder"
))]
#[method_id(@__retain_semantics Other accelerationStructureCommandEncoderWithDescriptor:)]
unsafe fn accelerationStructureCommandEncoderWithDescriptor(
&self,
descriptor: &MTLAccelerationStructurePassDescriptor,
) -> Retained<ProtocolObject<dyn MTLAccelerationStructureCommandEncoder>>;
#[method(pushDebugGroup:)]
fn pushDebugGroup(&self, string: &NSString);
#[method(popDebugGroup)]
fn popDebugGroup(&self);
}
unsafe impl ProtocolType for dyn MTLCommandBuffer {}
);

View File

@@ -0,0 +1,81 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLResourceUsage(pub NSUInteger);
bitflags::bitflags! {
impl MTLResourceUsage: NSUInteger {
#[doc(alias = "MTLResourceUsageRead")]
const Read = 1<<0;
#[doc(alias = "MTLResourceUsageWrite")]
const Write = 1<<1;
#[deprecated]
#[doc(alias = "MTLResourceUsageSample")]
const Sample = 1<<2;
}
}
unsafe impl Encode for MTLResourceUsage {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLResourceUsage {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBarrierScope(pub NSUInteger);
bitflags::bitflags! {
impl MTLBarrierScope: NSUInteger {
#[doc(alias = "MTLBarrierScopeBuffers")]
const Buffers = 1<<0;
#[doc(alias = "MTLBarrierScopeTextures")]
const Textures = 1<<1;
#[doc(alias = "MTLBarrierScopeRenderTargets")]
const RenderTargets = 1<<2;
}
}
unsafe impl Encode for MTLBarrierScope {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLBarrierScope {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLCommandEncoder: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
unsafe fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[method(endEncoding)]
fn endEncoding(&self);
#[method(insertDebugSignpost:)]
fn insertDebugSignpost(&self, string: &NSString);
#[method(pushDebugGroup:)]
fn pushDebugGroup(&self, string: &NSString);
#[method(popDebugGroup)]
fn popDebugGroup(&self);
}
unsafe impl ProtocolType for dyn MTLCommandEncoder {}
);

View File

@@ -0,0 +1,43 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLCommandQueue: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[cfg(feature = "MTLCommandBuffer")]
#[method_id(@__retain_semantics Other commandBuffer)]
fn commandBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>;
#[cfg(feature = "MTLCommandBuffer")]
#[method_id(@__retain_semantics Other commandBufferWithDescriptor:)]
unsafe fn commandBufferWithDescriptor(
&self,
descriptor: &MTLCommandBufferDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>;
#[cfg(feature = "MTLCommandBuffer")]
#[method_id(@__retain_semantics Other commandBufferWithUnretainedReferences)]
unsafe fn commandBufferWithUnretainedReferences(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>;
#[deprecated = "Use MTLCaptureScope instead"]
#[method(insertDebugCaptureBoundary)]
unsafe fn insertDebugCaptureBoundary(&self);
}
unsafe impl ProtocolType for dyn MTLCommandQueue {}
);

View File

@@ -0,0 +1,332 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLDispatchThreadgroupsIndirectArguments {
pub threadgroupsPerGrid: [u32; 3],
}
unsafe impl Encode for MTLDispatchThreadgroupsIndirectArguments {
const ENCODING: Encoding = Encoding::Struct("?", &[<[u32; 3]>::ENCODING]);
}
unsafe impl RefEncode for MTLDispatchThreadgroupsIndirectArguments {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLStageInRegionIndirectArguments {
pub stageInOrigin: [u32; 3],
pub stageInSize: [u32; 3],
}
unsafe impl Encode for MTLStageInRegionIndirectArguments {
const ENCODING: Encoding = Encoding::Struct("?", &[<[u32; 3]>::ENCODING, <[u32; 3]>::ENCODING]);
}
unsafe impl RefEncode for MTLStageInRegionIndirectArguments {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
#[cfg(feature = "MTLCommandEncoder")]
pub unsafe trait MTLComputeCommandEncoder: MTLCommandEncoder + IsRetainable {
#[cfg(feature = "MTLCommandBuffer")]
#[method(dispatchType)]
unsafe fn dispatchType(&self) -> MTLDispatchType;
#[cfg(feature = "MTLComputePipeline")]
#[method(setComputePipelineState:)]
fn setComputePipelineState(&self, state: &ProtocolObject<dyn MTLComputePipelineState>);
#[method(setBytes:length:atIndex:)]
unsafe fn setBytes_length_atIndex(
&self,
bytes: NonNull<c_void>,
length: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setBuffer:offset:atIndex:)]
unsafe fn setBuffer_offset_atIndex(
&self,
buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
offset: NSUInteger,
index: NSUInteger,
);
#[method(setBufferOffset:atIndex:)]
unsafe fn setBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setBuffers:offsets:withRange:)]
unsafe fn setBuffers_offsets_withRange(
&self,
buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
offsets: NonNull<NSUInteger>,
range: NSRange,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setBuffer:offset:attributeStride:atIndex:)]
unsafe fn setBuffer_offset_attributeStride_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
stride: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setBuffers:offsets:attributeStrides:withRange:)]
unsafe fn setBuffers_offsets_attributeStrides_withRange(
&self,
buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
offsets: NonNull<NSUInteger>,
strides: NonNull<NSUInteger>,
range: NSRange,
);
#[method(setBufferOffset:attributeStride:atIndex:)]
unsafe fn setBufferOffset_attributeStride_atIndex(
&self,
offset: NSUInteger,
stride: NSUInteger,
index: NSUInteger,
);
#[method(setBytes:length:attributeStride:atIndex:)]
unsafe fn setBytes_length_attributeStride_atIndex(
&self,
bytes: NonNull<c_void>,
length: NSUInteger,
stride: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
#[method(setVisibleFunctionTable:atBufferIndex:)]
unsafe fn setVisibleFunctionTable_atBufferIndex(
&self,
visible_function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
buffer_index: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
#[method(setVisibleFunctionTables:withBufferRange:)]
unsafe fn setVisibleFunctionTables_withBufferRange(
&self,
visible_function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
range: NSRange,
);
#[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
#[method(setIntersectionFunctionTable:atBufferIndex:)]
unsafe fn setIntersectionFunctionTable_atBufferIndex(
&self,
intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
buffer_index: NSUInteger,
);
#[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
#[method(setIntersectionFunctionTables:withBufferRange:)]
unsafe fn setIntersectionFunctionTables_withBufferRange(
&self,
intersection_function_tables: NonNull<
*const ProtocolObject<dyn MTLIntersectionFunctionTable>,
>,
range: NSRange,
);
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method(setAccelerationStructure:atBufferIndex:)]
unsafe fn setAccelerationStructure_atBufferIndex(
&self,
acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
buffer_index: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(setTexture:atIndex:)]
unsafe fn setTexture_atIndex(
&self,
texture: Option<&ProtocolObject<dyn MTLTexture>>,
index: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(setTextures:withRange:)]
unsafe fn setTextures_withRange(
&self,
textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
range: NSRange,
);
#[cfg(feature = "MTLSampler")]
#[method(setSamplerState:atIndex:)]
unsafe fn setSamplerState_atIndex(
&self,
sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
index: NSUInteger,
);
#[cfg(feature = "MTLSampler")]
#[method(setSamplerStates:withRange:)]
unsafe fn setSamplerStates_withRange(
&self,
samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
range: NSRange,
);
#[cfg(feature = "MTLSampler")]
#[method(setSamplerState:lodMinClamp:lodMaxClamp:atIndex:)]
unsafe fn setSamplerState_lodMinClamp_lodMaxClamp_atIndex(
&self,
sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
lod_min_clamp: c_float,
lod_max_clamp: c_float,
index: NSUInteger,
);
#[cfg(feature = "MTLSampler")]
#[method(setSamplerStates:lodMinClamps:lodMaxClamps:withRange:)]
unsafe fn setSamplerStates_lodMinClamps_lodMaxClamps_withRange(
&self,
samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
lod_min_clamps: NonNull<c_float>,
lod_max_clamps: NonNull<c_float>,
range: NSRange,
);
#[method(setThreadgroupMemoryLength:atIndex:)]
unsafe fn setThreadgroupMemoryLength_atIndex(&self, length: NSUInteger, index: NSUInteger);
#[method(setImageblockWidth:height:)]
unsafe fn setImageblockWidth_height(&self, width: NSUInteger, height: NSUInteger);
#[cfg(feature = "MTLTypes")]
#[method(setStageInRegion:)]
unsafe fn setStageInRegion(&self, region: MTLRegion);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setStageInRegionWithIndirectBuffer:indirectBufferOffset:)]
unsafe fn setStageInRegionWithIndirectBuffer_indirectBufferOffset(
&self,
indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
indirect_buffer_offset: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(dispatchThreadgroups:threadsPerThreadgroup:)]
fn dispatchThreadgroups_threadsPerThreadgroup(
&self,
threadgroups_per_grid: MTLSize,
threads_per_threadgroup: MTLSize,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource", feature = "MTLTypes"))]
#[method(dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:)]
unsafe fn dispatchThreadgroupsWithIndirectBuffer_indirectBufferOffset_threadsPerThreadgroup(
&self,
indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
indirect_buffer_offset: NSUInteger,
threads_per_threadgroup: MTLSize,
);
#[cfg(feature = "MTLTypes")]
#[method(dispatchThreads:threadsPerThreadgroup:)]
fn dispatchThreads_threadsPerThreadgroup(
&self,
threads_per_grid: MTLSize,
threads_per_threadgroup: MTLSize,
);
#[cfg(feature = "MTLFence")]
#[method(updateFence:)]
fn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(feature = "MTLFence")]
#[method(waitForFence:)]
fn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(feature = "MTLResource")]
#[method(useResource:usage:)]
fn useResource_usage(
&self,
resource: &ProtocolObject<dyn MTLResource>,
usage: MTLResourceUsage,
);
#[cfg(feature = "MTLResource")]
#[method(useResources:count:usage:)]
unsafe fn useResources_count_usage(
&self,
resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
count: NSUInteger,
usage: MTLResourceUsage,
);
#[cfg(feature = "MTLHeap")]
#[method(useHeap:)]
fn useHeap(&self, heap: &ProtocolObject<dyn MTLHeap>);
#[cfg(feature = "MTLHeap")]
#[method(useHeaps:count:)]
unsafe fn useHeaps_count(
&self,
heaps: NonNull<NonNull<ProtocolObject<dyn MTLHeap>>>,
count: NSUInteger,
);
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
#[method(executeCommandsInBuffer:withRange:)]
unsafe fn executeCommandsInBuffer_withRange(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
execution_range: NSRange,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLIndirectCommandBuffer",
feature = "MTLResource"
))]
#[method(executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:)]
unsafe fn executeCommandsInBuffer_indirectBuffer_indirectBufferOffset(
&self,
indirect_commandbuffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
indirect_range_buffer: &ProtocolObject<dyn MTLBuffer>,
indirect_buffer_offset: NSUInteger,
);
#[method(memoryBarrierWithScope:)]
unsafe fn memoryBarrierWithScope(&self, scope: MTLBarrierScope);
#[cfg(feature = "MTLResource")]
#[method(memoryBarrierWithResources:count:)]
unsafe fn memoryBarrierWithResources_count(
&self,
resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
count: NSUInteger,
);
#[cfg(feature = "MTLCounters")]
#[method(sampleCountersInBuffer:atSampleIndex:withBarrier:)]
unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
sample_index: NSUInteger,
barrier: bool,
);
}
#[cfg(feature = "MTLCommandEncoder")]
unsafe impl ProtocolType for dyn MTLComputeCommandEncoder {}
);

View File

@@ -0,0 +1,148 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLComputePassSampleBufferAttachmentDescriptor;
unsafe impl ClassType for MTLComputePassSampleBufferAttachmentDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLComputePassSampleBufferAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLComputePassSampleBufferAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLComputePassSampleBufferAttachmentDescriptor {
#[cfg(feature = "MTLCounters")]
#[method_id(@__retain_semantics Other sampleBuffer)]
pub unsafe fn sampleBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
#[cfg(feature = "MTLCounters")]
#[method(setSampleBuffer:)]
pub unsafe fn setSampleBuffer(
&self,
sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
);
#[method(startOfEncoderSampleIndex)]
pub unsafe fn startOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setStartOfEncoderSampleIndex:)]
pub unsafe fn setStartOfEncoderSampleIndex(
&self,
start_of_encoder_sample_index: NSUInteger,
);
#[method(endOfEncoderSampleIndex)]
pub unsafe fn endOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setEndOfEncoderSampleIndex:)]
pub unsafe fn setEndOfEncoderSampleIndex(&self, end_of_encoder_sample_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLComputePassSampleBufferAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLComputePassSampleBufferAttachmentDescriptorArray;
unsafe impl ClassType for MTLComputePassSampleBufferAttachmentDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLComputePassSampleBufferAttachmentDescriptorArray {}
extern_methods!(
unsafe impl MTLComputePassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLComputePassSampleBufferAttachmentDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLComputePassSampleBufferAttachmentDescriptor>,
attachment_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLComputePassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLComputePassDescriptor;
unsafe impl ClassType for MTLComputePassDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLComputePassDescriptor {}
unsafe impl NSObjectProtocol for MTLComputePassDescriptor {}
extern_methods!(
unsafe impl MTLComputePassDescriptor {
#[method_id(@__retain_semantics Other computePassDescriptor)]
pub unsafe fn computePassDescriptor() -> Retained<MTLComputePassDescriptor>;
#[cfg(feature = "MTLCommandBuffer")]
#[method(dispatchType)]
pub unsafe fn dispatchType(&self) -> MTLDispatchType;
#[cfg(feature = "MTLCommandBuffer")]
#[method(setDispatchType:)]
pub unsafe fn setDispatchType(&self, dispatch_type: MTLDispatchType);
#[method_id(@__retain_semantics Other sampleBufferAttachments)]
pub unsafe fn sampleBufferAttachments(
&self,
) -> Retained<MTLComputePassSampleBufferAttachmentDescriptorArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLComputePassDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,262 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLComputePipelineReflection;
unsafe impl ClassType for MTLComputePipelineReflection {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLComputePipelineReflection {}
extern_methods!(
unsafe impl MTLComputePipelineReflection {
#[cfg(feature = "MTLArgument")]
#[method_id(@__retain_semantics Other bindings)]
pub unsafe fn bindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
#[cfg(feature = "MTLArgument")]
#[deprecated]
#[method_id(@__retain_semantics Other arguments)]
pub fn arguments(&self) -> Retained<NSArray<MTLArgument>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLComputePipelineReflection {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLComputePipelineDescriptor;
unsafe impl ClassType for MTLComputePipelineDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLComputePipelineDescriptor {}
unsafe impl NSObjectProtocol for MTLComputePipelineDescriptor {}
extern_methods!(
unsafe impl MTLComputePipelineDescriptor {
#[method_id(@__retain_semantics Other label)]
pub fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
pub fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other computeFunction)]
pub fn computeFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
#[method(setComputeFunction:)]
pub fn setComputeFunction(
&self,
compute_function: Option<&ProtocolObject<dyn MTLFunction>>,
);
#[method(threadGroupSizeIsMultipleOfThreadExecutionWidth)]
pub fn threadGroupSizeIsMultipleOfThreadExecutionWidth(&self) -> bool;
#[method(setThreadGroupSizeIsMultipleOfThreadExecutionWidth:)]
pub unsafe fn setThreadGroupSizeIsMultipleOfThreadExecutionWidth(
&self,
thread_group_size_is_multiple_of_thread_execution_width: bool,
);
#[method(maxTotalThreadsPerThreadgroup)]
pub fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
#[method(setMaxTotalThreadsPerThreadgroup:)]
pub fn setMaxTotalThreadsPerThreadgroup(
&self,
max_total_threads_per_threadgroup: NSUInteger,
);
#[cfg(feature = "MTLStageInputOutputDescriptor")]
#[method_id(@__retain_semantics Other stageInputDescriptor)]
pub fn stageInputDescriptor(&self) -> Option<Retained<MTLStageInputOutputDescriptor>>;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
#[method(setStageInputDescriptor:)]
pub fn setStageInputDescriptor(
&self,
stage_input_descriptor: Option<&MTLStageInputOutputDescriptor>,
);
#[cfg(feature = "MTLPipeline")]
#[method_id(@__retain_semantics Other buffers)]
pub fn buffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
#[method(supportIndirectCommandBuffers)]
pub fn supportIndirectCommandBuffers(&self) -> bool;
#[method(setSupportIndirectCommandBuffers:)]
pub fn setSupportIndirectCommandBuffers(&self, support_indirect_command_buffers: bool);
#[cfg(feature = "MTLDynamicLibrary")]
#[deprecated]
#[method_id(@__retain_semantics Other insertLibraries)]
pub fn insertLibraries(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>>;
#[cfg(feature = "MTLDynamicLibrary")]
#[deprecated]
#[method(setInsertLibraries:)]
pub fn setInsertLibraries(
&self,
insert_libraries: Option<&NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>,
);
#[cfg(feature = "MTLDynamicLibrary")]
#[method_id(@__retain_semantics Other preloadedLibraries)]
pub fn preloadedLibraries(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;
#[cfg(feature = "MTLDynamicLibrary")]
#[method(setPreloadedLibraries:)]
pub fn setPreloadedLibraries(
&self,
preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
);
#[cfg(feature = "MTLBinaryArchive")]
#[method_id(@__retain_semantics Other binaryArchives)]
pub fn binaryArchives(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>>;
#[cfg(feature = "MTLBinaryArchive")]
#[method(setBinaryArchives:)]
pub fn setBinaryArchives(
&self,
binary_archives: Option<&NSArray<ProtocolObject<dyn MTLBinaryArchive>>>,
);
#[method(reset)]
pub fn reset(&self);
#[cfg(feature = "MTLLinkedFunctions")]
#[method_id(@__retain_semantics Other linkedFunctions)]
pub fn linkedFunctions(&self) -> Option<Retained<MTLLinkedFunctions>>;
#[cfg(feature = "MTLLinkedFunctions")]
#[method(setLinkedFunctions:)]
pub fn setLinkedFunctions(&self, linked_functions: Option<&MTLLinkedFunctions>);
#[method(supportAddingBinaryFunctions)]
pub fn supportAddingBinaryFunctions(&self) -> bool;
#[method(setSupportAddingBinaryFunctions:)]
pub fn setSupportAddingBinaryFunctions(&self, support_adding_binary_functions: bool);
#[method(maxCallStackDepth)]
pub fn maxCallStackDepth(&self) -> NSUInteger;
#[method(setMaxCallStackDepth:)]
pub fn setMaxCallStackDepth(&self, max_call_stack_depth: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLComputePipelineDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLComputePipelineDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait MTLComputePipelineState: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method(maxTotalThreadsPerThreadgroup)]
fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
#[method(threadExecutionWidth)]
fn threadExecutionWidth(&self) -> NSUInteger;
#[method(staticThreadgroupMemoryLength)]
fn staticThreadgroupMemoryLength(&self) -> NSUInteger;
#[cfg(feature = "MTLTypes")]
#[method(imageblockMemoryLengthForDimensions:)]
unsafe fn imageblockMemoryLengthForDimensions(
&self,
imageblock_dimensions: MTLSize,
) -> NSUInteger;
#[method(supportIndirectCommandBuffers)]
fn supportIndirectCommandBuffers(&self) -> bool;
#[cfg(feature = "MTLTypes")]
#[method(gpuResourceID)]
unsafe fn gpuResourceID(&self) -> MTLResourceID;
#[cfg(all(feature = "MTLFunctionHandle", feature = "MTLLibrary"))]
#[method_id(@__retain_semantics Other functionHandleWithFunction:)]
fn functionHandleWithFunction(
&self,
function: &ProtocolObject<dyn MTLFunction>,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics New newComputePipelineStateWithAdditionalBinaryFunctions:error:_)]
fn newComputePipelineStateWithAdditionalBinaryFunctions_error(
&self,
functions: &NSArray<ProtocolObject<dyn MTLFunction>>,
) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
#[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
#[method_id(@__retain_semantics New newVisibleFunctionTableWithDescriptor:)]
fn newVisibleFunctionTableWithDescriptor(
&self,
descriptor: &MTLVisibleFunctionTableDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLVisibleFunctionTable>>>;
#[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newIntersectionFunctionTableWithDescriptor:)]
fn newIntersectionFunctionTableWithDescriptor(
&self,
descriptor: &MTLIntersectionFunctionTableDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLIntersectionFunctionTable>>>;
}
unsafe impl ProtocolType for dyn MTLComputePipelineState {}
);

View File

@@ -0,0 +1,280 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_TYPED_ENUM
pub type MTLCommonCounter = NSString;
extern "C" {
pub static MTLCommonCounterTimestamp: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterTessellationInputPatches: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterVertexInvocations: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterPostTessellationVertexInvocations: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterClipperInvocations: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterClipperPrimitivesOut: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterFragmentInvocations: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterFragmentsPassed: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterComputeKernelInvocations: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterTotalCycles: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterVertexCycles: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterTessellationCycles: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterPostTessellationVertexCycles: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterFragmentCycles: &'static MTLCommonCounter;
}
extern "C" {
pub static MTLCommonCounterRenderTargetWriteCycles: &'static MTLCommonCounter;
}
// NS_TYPED_ENUM
pub type MTLCommonCounterSet = NSString;
extern "C" {
pub static MTLCommonCounterSetTimestamp: &'static MTLCommonCounterSet;
}
extern "C" {
pub static MTLCommonCounterSetStageUtilization: &'static MTLCommonCounterSet;
}
extern "C" {
pub static MTLCommonCounterSetStatistic: &'static MTLCommonCounterSet;
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLCounterResultTimestamp {
pub timestamp: u64,
}
unsafe impl Encode for MTLCounterResultTimestamp {
const ENCODING: Encoding = Encoding::Struct("?", &[<u64>::ENCODING]);
}
unsafe impl RefEncode for MTLCounterResultTimestamp {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLCounterResultStageUtilization {
pub totalCycles: u64,
pub vertexCycles: u64,
pub tessellationCycles: u64,
pub postTessellationVertexCycles: u64,
pub fragmentCycles: u64,
pub renderTargetCycles: u64,
}
unsafe impl Encode for MTLCounterResultStageUtilization {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLCounterResultStageUtilization {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLCounterResultStatistic {
pub tessellationInputPatches: u64,
pub vertexInvocations: u64,
pub postTessellationVertexInvocations: u64,
pub clipperInvocations: u64,
pub clipperPrimitivesOut: u64,
pub fragmentInvocations: u64,
pub fragmentsPassed: u64,
pub computeKernelInvocations: u64,
}
unsafe impl Encode for MTLCounterResultStatistic {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
<u64>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLCounterResultStatistic {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLCounter: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other name)]
unsafe fn name(&self) -> Retained<NSString>;
}
unsafe impl ProtocolType for dyn MTLCounter {}
);
extern_protocol!(
pub unsafe trait MTLCounterSet: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other name)]
unsafe fn name(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other counters)]
unsafe fn counters(&self) -> Retained<NSArray<ProtocolObject<dyn MTLCounter>>>;
}
unsafe impl ProtocolType for dyn MTLCounterSet {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLCounterSampleBufferDescriptor;
unsafe impl ClassType for MTLCounterSampleBufferDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLCounterSampleBufferDescriptor {}
unsafe impl NSObjectProtocol for MTLCounterSampleBufferDescriptor {}
extern_methods!(
unsafe impl MTLCounterSampleBufferDescriptor {
#[method_id(@__retain_semantics Other counterSet)]
pub unsafe fn counterSet(&self) -> Option<Retained<ProtocolObject<dyn MTLCounterSet>>>;
#[method(setCounterSet:)]
pub unsafe fn setCounterSet(&self, counter_set: Option<&ProtocolObject<dyn MTLCounterSet>>);
#[method_id(@__retain_semantics Other label)]
pub unsafe fn label(&self) -> Retained<NSString>;
#[method(setLabel:)]
pub unsafe fn setLabel(&self, label: &NSString);
#[cfg(feature = "MTLResource")]
#[method(storageMode)]
pub unsafe fn storageMode(&self) -> MTLStorageMode;
#[cfg(feature = "MTLResource")]
#[method(setStorageMode:)]
pub unsafe fn setStorageMode(&self, storage_mode: MTLStorageMode);
#[method(sampleCount)]
pub unsafe fn sampleCount(&self) -> NSUInteger;
#[method(setSampleCount:)]
pub unsafe fn setSampleCount(&self, sample_count: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLCounterSampleBufferDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLCounterSampleBuffer: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
unsafe fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Retained<NSString>;
#[method(sampleCount)]
unsafe fn sampleCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other resolveCounterRange:)]
unsafe fn resolveCounterRange(&self, range: NSRange) -> Option<Retained<NSData>>;
}
unsafe impl ProtocolType for dyn MTLCounterSampleBuffer {}
);
extern "C" {
pub static MTLCounterErrorDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCounterSampleBufferError(pub NSInteger);
impl MTLCounterSampleBufferError {
#[doc(alias = "MTLCounterSampleBufferErrorOutOfMemory")]
pub const OutOfMemory: Self = Self(0);
#[doc(alias = "MTLCounterSampleBufferErrorInvalid")]
pub const Invalid: Self = Self(1);
#[doc(alias = "MTLCounterSampleBufferErrorInternal")]
pub const Internal: Self = Self(2);
}
unsafe impl Encode for MTLCounterSampleBufferError {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLCounterSampleBufferError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

View File

@@ -0,0 +1,2 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT

View File

@@ -0,0 +1,208 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCompareFunction(pub NSUInteger);
impl MTLCompareFunction {
#[doc(alias = "MTLCompareFunctionNever")]
pub const Never: Self = Self(0);
#[doc(alias = "MTLCompareFunctionLess")]
pub const Less: Self = Self(1);
#[doc(alias = "MTLCompareFunctionEqual")]
pub const Equal: Self = Self(2);
#[doc(alias = "MTLCompareFunctionLessEqual")]
pub const LessEqual: Self = Self(3);
#[doc(alias = "MTLCompareFunctionGreater")]
pub const Greater: Self = Self(4);
#[doc(alias = "MTLCompareFunctionNotEqual")]
pub const NotEqual: Self = Self(5);
#[doc(alias = "MTLCompareFunctionGreaterEqual")]
pub const GreaterEqual: Self = Self(6);
#[doc(alias = "MTLCompareFunctionAlways")]
pub const Always: Self = Self(7);
}
unsafe impl Encode for MTLCompareFunction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLCompareFunction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLStencilOperation(pub NSUInteger);
impl MTLStencilOperation {
#[doc(alias = "MTLStencilOperationKeep")]
pub const Keep: Self = Self(0);
#[doc(alias = "MTLStencilOperationZero")]
pub const Zero: Self = Self(1);
#[doc(alias = "MTLStencilOperationReplace")]
pub const Replace: Self = Self(2);
#[doc(alias = "MTLStencilOperationIncrementClamp")]
pub const IncrementClamp: Self = Self(3);
#[doc(alias = "MTLStencilOperationDecrementClamp")]
pub const DecrementClamp: Self = Self(4);
#[doc(alias = "MTLStencilOperationInvert")]
pub const Invert: Self = Self(5);
#[doc(alias = "MTLStencilOperationIncrementWrap")]
pub const IncrementWrap: Self = Self(6);
#[doc(alias = "MTLStencilOperationDecrementWrap")]
pub const DecrementWrap: Self = Self(7);
}
unsafe impl Encode for MTLStencilOperation {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLStencilOperation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLStencilDescriptor;
unsafe impl ClassType for MTLStencilDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLStencilDescriptor {}
unsafe impl NSObjectProtocol for MTLStencilDescriptor {}
extern_methods!(
unsafe impl MTLStencilDescriptor {
#[method(stencilCompareFunction)]
pub fn stencilCompareFunction(&self) -> MTLCompareFunction;
#[method(setStencilCompareFunction:)]
pub fn setStencilCompareFunction(&self, stencil_compare_function: MTLCompareFunction);
#[method(stencilFailureOperation)]
pub fn stencilFailureOperation(&self) -> MTLStencilOperation;
#[method(setStencilFailureOperation:)]
pub fn setStencilFailureOperation(&self, stencil_failure_operation: MTLStencilOperation);
#[method(depthFailureOperation)]
pub fn depthFailureOperation(&self) -> MTLStencilOperation;
#[method(setDepthFailureOperation:)]
pub fn setDepthFailureOperation(&self, depth_failure_operation: MTLStencilOperation);
#[method(depthStencilPassOperation)]
pub fn depthStencilPassOperation(&self) -> MTLStencilOperation;
#[method(setDepthStencilPassOperation:)]
pub fn setDepthStencilPassOperation(
&self,
depth_stencil_pass_operation: MTLStencilOperation,
);
#[method(readMask)]
pub fn readMask(&self) -> u32;
#[method(setReadMask:)]
pub fn setReadMask(&self, read_mask: u32);
#[method(writeMask)]
pub fn writeMask(&self) -> u32;
#[method(setWriteMask:)]
pub fn setWriteMask(&self, write_mask: u32);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLStencilDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLDepthStencilDescriptor;
unsafe impl ClassType for MTLDepthStencilDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLDepthStencilDescriptor {}
unsafe impl NSObjectProtocol for MTLDepthStencilDescriptor {}
extern_methods!(
unsafe impl MTLDepthStencilDescriptor {
#[method(depthCompareFunction)]
pub fn depthCompareFunction(&self) -> MTLCompareFunction;
#[method(setDepthCompareFunction:)]
pub fn setDepthCompareFunction(&self, depth_compare_function: MTLCompareFunction);
#[method(isDepthWriteEnabled)]
pub fn isDepthWriteEnabled(&self) -> bool;
#[method(setDepthWriteEnabled:)]
pub fn setDepthWriteEnabled(&self, depth_write_enabled: bool);
#[method_id(@__retain_semantics Other frontFaceStencil)]
pub fn frontFaceStencil(&self) -> Retained<MTLStencilDescriptor>;
#[method(setFrontFaceStencil:)]
pub fn setFrontFaceStencil(&self, front_face_stencil: Option<&MTLStencilDescriptor>);
#[method_id(@__retain_semantics Other backFaceStencil)]
pub fn backFaceStencil(&self) -> Retained<MTLStencilDescriptor>;
#[method(setBackFaceStencil:)]
pub fn setBackFaceStencil(&self, back_face_stencil: Option<&MTLStencilDescriptor>);
#[method_id(@__retain_semantics Other label)]
pub fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
pub fn setLabel(&self, label: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLDepthStencilDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLDepthStencilState: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
}
unsafe impl ProtocolType for dyn MTLDepthStencilState {}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "block2")]
pub type MTLDrawablePresentedHandler =
*mut block2::Block<dyn Fn(NonNull<ProtocolObject<dyn MTLDrawable>>)>;
extern_protocol!(
pub unsafe trait MTLDrawable: NSObjectProtocol + IsRetainable {
#[method(present)]
fn present(&self);
#[method(presentAtTime:)]
unsafe fn presentAtTime(&self, presentation_time: CFTimeInterval);
#[method(presentAfterMinimumDuration:)]
unsafe fn presentAfterMinimumDuration(&self, duration: CFTimeInterval);
#[cfg(feature = "block2")]
#[method(addPresentedHandler:)]
unsafe fn addPresentedHandler(&self, block: MTLDrawablePresentedHandler);
#[method(presentedTime)]
unsafe fn presentedTime(&self) -> CFTimeInterval;
#[method(drawableID)]
fn drawableID(&self) -> NSUInteger;
}
unsafe impl ProtocolType for dyn MTLDrawable {}
);

View File

@@ -0,0 +1,59 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static MTLDynamicLibraryDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLDynamicLibraryError(pub NSUInteger);
impl MTLDynamicLibraryError {
#[doc(alias = "MTLDynamicLibraryErrorNone")]
pub const None: Self = Self(0);
#[doc(alias = "MTLDynamicLibraryErrorInvalidFile")]
pub const InvalidFile: Self = Self(1);
#[doc(alias = "MTLDynamicLibraryErrorCompilationFailure")]
pub const CompilationFailure: Self = Self(2);
#[doc(alias = "MTLDynamicLibraryErrorUnresolvedInstallName")]
pub const UnresolvedInstallName: Self = Self(3);
#[doc(alias = "MTLDynamicLibraryErrorDependencyLoadFailure")]
pub const DependencyLoadFailure: Self = Self(4);
#[doc(alias = "MTLDynamicLibraryErrorUnsupported")]
pub const Unsupported: Self = Self(5);
}
unsafe impl Encode for MTLDynamicLibraryError {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLDynamicLibraryError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLDynamicLibrary: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other installName)]
fn installName(&self) -> Retained<NSString>;
#[method(serializeToURL:error:_)]
fn serializeToURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
}
unsafe impl ProtocolType for dyn MTLDynamicLibrary {}
);

View File

@@ -0,0 +1,121 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLEvent: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
}
unsafe impl ProtocolType for dyn MTLEvent {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLSharedEventListener;
unsafe impl ClassType for MTLSharedEventListener {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLSharedEventListener {}
extern_methods!(
unsafe impl MTLSharedEventListener {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLSharedEventListener {
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLSharedEventListener {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
#[cfg(feature = "block2")]
pub type MTLSharedEventNotificationBlock =
*mut block2::Block<dyn Fn(NonNull<ProtocolObject<dyn MTLSharedEvent>>, u64)>;
extern_protocol!(
pub unsafe trait MTLSharedEvent: MTLEvent + IsRetainable {
#[cfg(feature = "block2")]
#[method(notifyListener:atValue:block:)]
unsafe fn notifyListener_atValue_block(
&self,
listener: &MTLSharedEventListener,
value: u64,
block: MTLSharedEventNotificationBlock,
);
#[method_id(@__retain_semantics New newSharedEventHandle)]
unsafe fn newSharedEventHandle(&self) -> Retained<MTLSharedEventHandle>;
#[method(waitUntilSignaledValue:timeoutMS:)]
unsafe fn waitUntilSignaledValue_timeoutMS(&self, value: u64, milliseconds: u64) -> bool;
#[method(signaledValue)]
unsafe fn signaledValue(&self) -> u64;
#[method(setSignaledValue:)]
unsafe fn setSignaledValue(&self, signaled_value: u64);
}
unsafe impl ProtocolType for dyn MTLSharedEvent {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLSharedEventHandle;
unsafe impl ClassType for MTLSharedEventHandle {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for MTLSharedEventHandle {}
unsafe impl NSObjectProtocol for MTLSharedEventHandle {}
unsafe impl NSSecureCoding for MTLSharedEventHandle {}
extern_methods!(
unsafe impl MTLSharedEventHandle {
#[method_id(@__retain_semantics Other label)]
pub fn label(&self) -> Option<Retained<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLSharedEventHandle {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,22 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLFence: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
}
unsafe impl ProtocolType for dyn MTLFence {}
);

View File

@@ -0,0 +1,72 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionConstantValues;
unsafe impl ClassType for MTLFunctionConstantValues {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLFunctionConstantValues {}
unsafe impl NSObjectProtocol for MTLFunctionConstantValues {}
extern_methods!(
unsafe impl MTLFunctionConstantValues {
#[cfg(feature = "MTLArgument")]
#[method(setConstantValue:type:atIndex:)]
pub unsafe fn setConstantValue_type_atIndex(
&self,
value: NonNull<c_void>,
r#type: MTLDataType,
index: NSUInteger,
);
#[cfg(feature = "MTLArgument")]
#[method(setConstantValues:type:withRange:)]
pub unsafe fn setConstantValues_type_withRange(
&self,
values: NonNull<c_void>,
r#type: MTLDataType,
range: NSRange,
);
#[cfg(feature = "MTLArgument")]
#[method(setConstantValue:type:withName:)]
pub unsafe fn setConstantValue_type_withName(
&self,
value: NonNull<c_void>,
r#type: MTLDataType,
name: &NSString,
);
#[method(reset)]
pub fn reset(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionConstantValues {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLFunctionConstantValues {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}

View File

@@ -0,0 +1,134 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLFunctionOptions(pub NSUInteger);
bitflags::bitflags! {
impl MTLFunctionOptions: NSUInteger {
const MTLFunctionOptionNone = 0;
const MTLFunctionOptionCompileToBinary = 1<<0;
const MTLFunctionOptionStoreFunctionInMetalScript = 1<<1;
}
}
unsafe impl Encode for MTLFunctionOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLFunctionOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionDescriptor;
unsafe impl ClassType for MTLFunctionDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLFunctionDescriptor {}
unsafe impl NSObjectProtocol for MTLFunctionDescriptor {}
extern_methods!(
unsafe impl MTLFunctionDescriptor {
#[method_id(@__retain_semantics Other functionDescriptor)]
pub fn functionDescriptor() -> Retained<MTLFunctionDescriptor>;
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Option<Retained<NSString>>;
#[method(setName:)]
pub fn setName(&self, name: Option<&NSString>);
#[method_id(@__retain_semantics Other specializedName)]
pub fn specializedName(&self) -> Option<Retained<NSString>>;
#[method(setSpecializedName:)]
pub fn setSpecializedName(&self, specialized_name: Option<&NSString>);
#[cfg(feature = "MTLFunctionConstantValues")]
#[method_id(@__retain_semantics Other constantValues)]
pub fn constantValues(&self) -> Option<Retained<MTLFunctionConstantValues>>;
#[cfg(feature = "MTLFunctionConstantValues")]
#[method(setConstantValues:)]
pub fn setConstantValues(&self, constant_values: Option<&MTLFunctionConstantValues>);
#[method(options)]
pub fn options(&self) -> MTLFunctionOptions;
#[method(setOptions:)]
pub fn setOptions(&self, options: MTLFunctionOptions);
#[cfg(feature = "MTLBinaryArchive")]
#[method_id(@__retain_semantics Other binaryArchives)]
pub unsafe fn binaryArchives(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>>;
#[cfg(feature = "MTLBinaryArchive")]
#[method(setBinaryArchives:)]
pub unsafe fn setBinaryArchives(
&self,
binary_archives: Option<&NSArray<ProtocolObject<dyn MTLBinaryArchive>>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLFunctionDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLIntersectionFunctionDescriptor;
unsafe impl ClassType for MTLIntersectionFunctionDescriptor {
#[inherits(NSObject)]
type Super = MTLFunctionDescriptor;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLIntersectionFunctionDescriptor {}
unsafe impl NSObjectProtocol for MTLIntersectionFunctionDescriptor {}
extern_methods!(
unsafe impl MTLIntersectionFunctionDescriptor {}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLIntersectionFunctionDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,23 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLFunctionHandle: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLLibrary")]
#[method(functionType)]
fn functionType(&self) -> MTLFunctionType;
#[method_id(@__retain_semantics Other name)]
fn name(&self) -> Retained<NSString>;
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
}
unsafe impl ProtocolType for dyn MTLFunctionHandle {}
);

View File

@@ -0,0 +1,68 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLFunctionLogType(pub NSUInteger);
impl MTLFunctionLogType {
#[doc(alias = "MTLFunctionLogTypeValidation")]
pub const Validation: Self = Self(0);
}
unsafe impl Encode for MTLFunctionLogType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLFunctionLogType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLLogContainer: NSFastEnumeration + IsRetainable {}
unsafe impl ProtocolType for dyn MTLLogContainer {}
);
extern_protocol!(
pub unsafe trait MTLFunctionLogDebugLocation: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other functionName)]
unsafe fn functionName(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other URL)]
unsafe fn URL(&self) -> Option<Retained<NSURL>>;
#[method(line)]
unsafe fn line(&self) -> NSUInteger;
#[method(column)]
unsafe fn column(&self) -> NSUInteger;
}
unsafe impl ProtocolType for dyn MTLFunctionLogDebugLocation {}
);
extern_protocol!(
pub unsafe trait MTLFunctionLog: NSObjectProtocol + IsRetainable {
#[method(type)]
unsafe fn r#type(&self) -> MTLFunctionLogType;
#[method_id(@__retain_semantics Other encoderLabel)]
unsafe fn encoderLabel(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other function)]
unsafe fn function(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[method_id(@__retain_semantics Other debugLocation)]
unsafe fn debugLocation(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionLogDebugLocation>>>;
}
unsafe impl ProtocolType for dyn MTLFunctionLog {}
);

View File

@@ -0,0 +1,273 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLFunctionStitchingAttribute: NSObjectProtocol + IsRetainable {}
unsafe impl ProtocolType for dyn MTLFunctionStitchingAttribute {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingAttributeAlwaysInline;
unsafe impl ClassType for MTLFunctionStitchingAttributeAlwaysInline {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl MTLFunctionStitchingAttribute for MTLFunctionStitchingAttributeAlwaysInline {}
unsafe impl NSObjectProtocol for MTLFunctionStitchingAttributeAlwaysInline {}
extern_methods!(
unsafe impl MTLFunctionStitchingAttributeAlwaysInline {}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionStitchingAttributeAlwaysInline {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLFunctionStitchingNode:
NSCopying + NSObjectProtocol + IsRetainable
{
}
unsafe impl ProtocolType for dyn MTLFunctionStitchingNode {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingInputNode;
unsafe impl ClassType for MTLFunctionStitchingInputNode {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl MTLFunctionStitchingNode for MTLFunctionStitchingInputNode {}
unsafe impl NSCopying for MTLFunctionStitchingInputNode {}
unsafe impl NSObjectProtocol for MTLFunctionStitchingInputNode {}
extern_methods!(
unsafe impl MTLFunctionStitchingInputNode {
#[method(argumentIndex)]
pub unsafe fn argumentIndex(&self) -> NSUInteger;
#[method(setArgumentIndex:)]
pub unsafe fn setArgumentIndex(&self, argument_index: NSUInteger);
#[method_id(@__retain_semantics Init initWithArgumentIndex:)]
pub unsafe fn initWithArgumentIndex(
this: Allocated<Self>,
argument: NSUInteger,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionStitchingInputNode {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingFunctionNode;
unsafe impl ClassType for MTLFunctionStitchingFunctionNode {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl MTLFunctionStitchingNode for MTLFunctionStitchingFunctionNode {}
unsafe impl NSCopying for MTLFunctionStitchingFunctionNode {}
unsafe impl NSObjectProtocol for MTLFunctionStitchingFunctionNode {}
extern_methods!(
unsafe impl MTLFunctionStitchingFunctionNode {
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSString>;
#[method(setName:)]
pub unsafe fn setName(&self, name: &NSString);
#[method_id(@__retain_semantics Other arguments)]
pub unsafe fn arguments(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>>;
#[method(setArguments:)]
pub unsafe fn setArguments(
&self,
arguments: &NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>,
);
#[method_id(@__retain_semantics Other controlDependencies)]
pub unsafe fn controlDependencies(
&self,
) -> Retained<NSArray<MTLFunctionStitchingFunctionNode>>;
#[method(setControlDependencies:)]
pub unsafe fn setControlDependencies(
&self,
control_dependencies: &NSArray<MTLFunctionStitchingFunctionNode>,
);
#[method_id(@__retain_semantics Init initWithName:arguments:controlDependencies:)]
pub unsafe fn initWithName_arguments_controlDependencies(
this: Allocated<Self>,
name: &NSString,
arguments: &NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>,
control_dependencies: &NSArray<MTLFunctionStitchingFunctionNode>,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionStitchingFunctionNode {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionStitchingGraph;
unsafe impl ClassType for MTLFunctionStitchingGraph {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLFunctionStitchingGraph {}
unsafe impl NSObjectProtocol for MTLFunctionStitchingGraph {}
extern_methods!(
unsafe impl MTLFunctionStitchingGraph {
#[method_id(@__retain_semantics Other functionName)]
pub unsafe fn functionName(&self) -> Retained<NSString>;
#[method(setFunctionName:)]
pub unsafe fn setFunctionName(&self, function_name: &NSString);
#[method_id(@__retain_semantics Other nodes)]
pub unsafe fn nodes(&self) -> Retained<NSArray<MTLFunctionStitchingFunctionNode>>;
#[method(setNodes:)]
pub unsafe fn setNodes(&self, nodes: &NSArray<MTLFunctionStitchingFunctionNode>);
#[method_id(@__retain_semantics Other outputNode)]
pub unsafe fn outputNode(&self) -> Option<Retained<MTLFunctionStitchingFunctionNode>>;
#[method(setOutputNode:)]
pub unsafe fn setOutputNode(&self, output_node: Option<&MTLFunctionStitchingFunctionNode>);
#[method_id(@__retain_semantics Other attributes)]
pub unsafe fn attributes(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>>;
#[method(setAttributes:)]
pub unsafe fn setAttributes(
&self,
attributes: &NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>,
);
#[method_id(@__retain_semantics Init initWithFunctionName:nodes:outputNode:attributes:)]
pub unsafe 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>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionStitchingGraph {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLStitchedLibraryDescriptor;
unsafe impl ClassType for MTLStitchedLibraryDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLStitchedLibraryDescriptor {}
unsafe impl NSObjectProtocol for MTLStitchedLibraryDescriptor {}
extern_methods!(
unsafe impl MTLStitchedLibraryDescriptor {
#[method_id(@__retain_semantics Other functionGraphs)]
pub unsafe fn functionGraphs(&self) -> Retained<NSArray<MTLFunctionStitchingGraph>>;
#[method(setFunctionGraphs:)]
pub unsafe fn setFunctionGraphs(
&self,
function_graphs: &NSArray<MTLFunctionStitchingGraph>,
);
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other functions)]
pub unsafe fn functions(&self) -> Retained<NSArray<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
#[method(setFunctions:)]
pub unsafe fn setFunctions(&self, functions: &NSArray<ProtocolObject<dyn MTLFunction>>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLStitchedLibraryDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,221 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLHeapType(pub NSInteger);
impl MTLHeapType {
#[doc(alias = "MTLHeapTypeAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "MTLHeapTypePlacement")]
pub const Placement: Self = Self(1);
#[doc(alias = "MTLHeapTypeSparse")]
pub const Sparse: Self = Self(2);
}
unsafe impl Encode for MTLHeapType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLHeapType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLHeapDescriptor;
unsafe impl ClassType for MTLHeapDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLHeapDescriptor {}
unsafe impl NSObjectProtocol for MTLHeapDescriptor {}
extern_methods!(
unsafe impl MTLHeapDescriptor {
#[method(size)]
pub fn size(&self) -> NSUInteger;
#[method(setSize:)]
pub fn setSize(&self, size: NSUInteger);
#[cfg(feature = "MTLResource")]
#[method(storageMode)]
pub fn storageMode(&self) -> MTLStorageMode;
#[cfg(feature = "MTLResource")]
#[method(setStorageMode:)]
pub fn setStorageMode(&self, storage_mode: MTLStorageMode);
#[cfg(feature = "MTLResource")]
#[method(cpuCacheMode)]
pub fn cpuCacheMode(&self) -> MTLCPUCacheMode;
#[cfg(feature = "MTLResource")]
#[method(setCpuCacheMode:)]
pub fn setCpuCacheMode(&self, cpu_cache_mode: MTLCPUCacheMode);
#[cfg(feature = "MTLDevice")]
#[method(sparsePageSize)]
pub unsafe fn sparsePageSize(&self) -> MTLSparsePageSize;
#[cfg(feature = "MTLDevice")]
#[method(setSparsePageSize:)]
pub unsafe fn setSparsePageSize(&self, sparse_page_size: MTLSparsePageSize);
#[cfg(feature = "MTLResource")]
#[method(hazardTrackingMode)]
pub fn hazardTrackingMode(&self) -> MTLHazardTrackingMode;
#[cfg(feature = "MTLResource")]
#[method(setHazardTrackingMode:)]
pub fn setHazardTrackingMode(&self, hazard_tracking_mode: MTLHazardTrackingMode);
#[cfg(feature = "MTLResource")]
#[method(resourceOptions)]
pub fn resourceOptions(&self) -> MTLResourceOptions;
#[cfg(feature = "MTLResource")]
#[method(setResourceOptions:)]
pub fn setResourceOptions(&self, resource_options: MTLResourceOptions);
#[method(type)]
pub unsafe fn r#type(&self) -> MTLHeapType;
#[method(setType:)]
pub fn setType(&self, r#type: MTLHeapType);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLHeapDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLHeap: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[cfg(feature = "MTLResource")]
#[method(storageMode)]
fn storageMode(&self) -> MTLStorageMode;
#[cfg(feature = "MTLResource")]
#[method(cpuCacheMode)]
fn cpuCacheMode(&self) -> MTLCPUCacheMode;
#[cfg(feature = "MTLResource")]
#[method(hazardTrackingMode)]
fn hazardTrackingMode(&self) -> MTLHazardTrackingMode;
#[cfg(feature = "MTLResource")]
#[method(resourceOptions)]
fn resourceOptions(&self) -> MTLResourceOptions;
#[method(size)]
fn size(&self) -> NSUInteger;
#[method(usedSize)]
fn usedSize(&self) -> NSUInteger;
#[method(currentAllocatedSize)]
fn currentAllocatedSize(&self) -> NSUInteger;
#[method(maxAvailableSizeWithAlignment:)]
fn maxAvailableSizeWithAlignment(&self, alignment: NSUInteger) -> NSUInteger;
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newBufferWithLength:options:)]
fn newBufferWithLength_options(
&self,
length: NSUInteger,
options: MTLResourceOptions,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method_id(@__retain_semantics New newTextureWithDescriptor:)]
fn newTextureWithDescriptor(
&self,
descriptor: &MTLTextureDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(feature = "MTLResource")]
#[method(setPurgeableState:)]
fn setPurgeableState(&self, state: MTLPurgeableState) -> MTLPurgeableState;
#[method(type)]
unsafe fn r#type(&self) -> MTLHeapType;
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newBufferWithLength:options:offset:)]
unsafe fn newBufferWithLength_options_offset(
&self,
length: NSUInteger,
options: MTLResourceOptions,
offset: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method_id(@__retain_semantics New newTextureWithDescriptor:offset:)]
unsafe fn newTextureWithDescriptor_offset(
&self,
descriptor: &MTLTextureDescriptor,
offset: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newAccelerationStructureWithSize:)]
unsafe fn newAccelerationStructureWithSize(
&self,
size: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLAccelerationStructure>>>;
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newAccelerationStructureWithDescriptor:)]
unsafe fn newAccelerationStructureWithDescriptor(
&self,
descriptor: &MTLAccelerationStructureDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLAccelerationStructure>>>;
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newAccelerationStructureWithSize:offset:)]
unsafe fn newAccelerationStructureWithSize_offset(
&self,
size: NSUInteger,
offset: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLAccelerationStructure>>>;
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
#[method_id(@__retain_semantics New newAccelerationStructureWithDescriptor:offset:)]
unsafe fn newAccelerationStructureWithDescriptor_offset(
&self,
descriptor: &MTLAccelerationStructureDescriptor,
offset: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLAccelerationStructure>>>;
}
unsafe impl ProtocolType for dyn MTLHeap {}
);

View File

@@ -0,0 +1,137 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIOStatus(pub NSInteger);
impl MTLIOStatus {
#[doc(alias = "MTLIOStatusPending")]
pub const Pending: Self = Self(0);
#[doc(alias = "MTLIOStatusCancelled")]
pub const Cancelled: Self = Self(1);
#[doc(alias = "MTLIOStatusError")]
pub const Error: Self = Self(2);
#[doc(alias = "MTLIOStatusComplete")]
pub const Complete: Self = Self(3);
}
unsafe impl Encode for MTLIOStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLIOStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type MTLIOCommandBufferHandler =
*mut block2::Block<dyn Fn(NonNull<ProtocolObject<dyn MTLIOCommandBuffer>>)>;
extern_protocol!(
pub unsafe trait MTLIOCommandBuffer: NSObjectProtocol + IsRetainable {
#[cfg(feature = "block2")]
#[method(addCompletedHandler:)]
unsafe fn addCompletedHandler(&self, block: MTLIOCommandBufferHandler);
#[cfg(feature = "MTLIOCommandQueue")]
#[method(loadBytes:size:sourceHandle:sourceHandleOffset:)]
unsafe fn loadBytes_size_sourceHandle_sourceHandleOffset(
&self,
pointer: NonNull<c_void>,
size: NSUInteger,
source_handle: &ProtocolObject<dyn MTLIOFileHandle>,
source_handle_offset: NSUInteger,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLIOCommandQueue",
feature = "MTLResource"
))]
#[method(loadBuffer:offset:size:sourceHandle:sourceHandleOffset:)]
unsafe fn loadBuffer_offset_size_sourceHandle_sourceHandleOffset(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
size: NSUInteger,
source_handle: &ProtocolObject<dyn MTLIOFileHandle>,
source_handle_offset: NSUInteger,
);
#[cfg(all(
feature = "MTLIOCommandQueue",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))]
#[method(loadTexture:slice:level:size:sourceBytesPerRow:sourceBytesPerImage:destinationOrigin:sourceHandle:sourceHandleOffset:)]
unsafe fn loadTexture_slice_level_size_sourceBytesPerRow_sourceBytesPerImage_destinationOrigin_sourceHandle_sourceHandleOffset(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
size: MTLSize,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
destination_origin: MTLOrigin,
source_handle: &ProtocolObject<dyn MTLIOFileHandle>,
source_handle_offset: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(copyStatusToBuffer:offset:)]
unsafe fn copyStatusToBuffer_offset(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
);
#[method(commit)]
unsafe fn commit(&self);
#[method(waitUntilCompleted)]
unsafe fn waitUntilCompleted(&self);
#[method(tryCancel)]
unsafe fn tryCancel(&self);
#[method(addBarrier)]
unsafe fn addBarrier(&self);
#[method(pushDebugGroup:)]
unsafe fn pushDebugGroup(&self, string: &NSString);
#[method(popDebugGroup)]
unsafe fn popDebugGroup(&self);
#[method(enqueue)]
unsafe fn enqueue(&self);
#[cfg(feature = "MTLEvent")]
#[method(waitForEvent:value:)]
unsafe fn waitForEvent_value(&self, event: &ProtocolObject<dyn MTLSharedEvent>, value: u64);
#[cfg(feature = "MTLEvent")]
#[method(signalEvent:value:)]
unsafe fn signalEvent_value(&self, event: &ProtocolObject<dyn MTLSharedEvent>, value: u64);
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
#[method(status)]
unsafe fn status(&self) -> MTLIOStatus;
#[method_id(@__retain_semantics Other error)]
unsafe fn error(&self) -> Option<Retained<NSError>>;
}
unsafe impl ProtocolType for dyn MTLIOCommandBuffer {}
);

View File

@@ -0,0 +1,192 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIOPriority(pub NSInteger);
impl MTLIOPriority {
#[doc(alias = "MTLIOPriorityHigh")]
pub const High: Self = Self(0);
#[doc(alias = "MTLIOPriorityNormal")]
pub const Normal: Self = Self(1);
#[doc(alias = "MTLIOPriorityLow")]
pub const Low: Self = Self(2);
}
unsafe impl Encode for MTLIOPriority {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLIOPriority {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIOCommandQueueType(pub NSInteger);
impl MTLIOCommandQueueType {
#[doc(alias = "MTLIOCommandQueueTypeConcurrent")]
pub const Concurrent: Self = Self(0);
#[doc(alias = "MTLIOCommandQueueTypeSerial")]
pub const Serial: Self = Self(1);
}
unsafe impl Encode for MTLIOCommandQueueType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLIOCommandQueueType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static MTLIOErrorDomain: &'static NSErrorDomain;
}
// NS_ERROR_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIOError(pub NSInteger);
impl MTLIOError {
#[doc(alias = "MTLIOErrorURLInvalid")]
pub const URLInvalid: Self = Self(1);
#[doc(alias = "MTLIOErrorInternal")]
pub const Internal: Self = Self(2);
}
unsafe impl Encode for MTLIOError {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLIOError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLIOCommandQueue: NSObjectProtocol + IsRetainable {
#[method(enqueueBarrier)]
unsafe fn enqueueBarrier(&self);
#[cfg(feature = "MTLIOCommandBuffer")]
#[method_id(@__retain_semantics Other commandBuffer)]
unsafe fn commandBuffer(&self) -> Retained<ProtocolObject<dyn MTLIOCommandBuffer>>;
#[cfg(feature = "MTLIOCommandBuffer")]
#[method_id(@__retain_semantics Other commandBufferWithUnretainedReferences)]
unsafe fn commandBufferWithUnretainedReferences(
&self,
) -> Retained<ProtocolObject<dyn MTLIOCommandBuffer>>;
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
}
unsafe impl ProtocolType for dyn MTLIOCommandQueue {}
);
extern_protocol!(
pub unsafe trait MTLIOScratchBuffer: NSObjectProtocol + IsRetainable {
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method_id(@__retain_semantics Other buffer)]
unsafe fn buffer(&self) -> Retained<ProtocolObject<dyn MTLBuffer>>;
}
unsafe impl ProtocolType for dyn MTLIOScratchBuffer {}
);
extern_protocol!(
pub unsafe trait MTLIOScratchBufferAllocator: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics New newScratchBufferWithMinimumSize:)]
unsafe fn newScratchBufferWithMinimumSize(
&self,
minimum_size: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLIOScratchBuffer>>>;
}
unsafe impl ProtocolType for dyn MTLIOScratchBufferAllocator {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLIOCommandQueueDescriptor;
unsafe impl ClassType for MTLIOCommandQueueDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLIOCommandQueueDescriptor {}
unsafe impl NSObjectProtocol for MTLIOCommandQueueDescriptor {}
extern_methods!(
unsafe impl MTLIOCommandQueueDescriptor {
#[method(maxCommandBufferCount)]
pub unsafe fn maxCommandBufferCount(&self) -> NSUInteger;
#[method(setMaxCommandBufferCount:)]
pub unsafe fn setMaxCommandBufferCount(&self, max_command_buffer_count: NSUInteger);
#[method(priority)]
pub unsafe fn priority(&self) -> MTLIOPriority;
#[method(setPriority:)]
pub unsafe fn setPriority(&self, priority: MTLIOPriority);
#[method(type)]
pub unsafe fn r#type(&self) -> MTLIOCommandQueueType;
#[method(setType:)]
pub unsafe fn setType(&self, r#type: MTLIOCommandQueueType);
#[method(maxCommandsInFlight)]
pub unsafe fn maxCommandsInFlight(&self) -> NSUInteger;
#[method(setMaxCommandsInFlight:)]
pub unsafe fn setMaxCommandsInFlight(&self, max_commands_in_flight: NSUInteger);
#[method_id(@__retain_semantics Other scratchBufferAllocator)]
pub unsafe fn scratchBufferAllocator(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLIOScratchBufferAllocator>>>;
#[method(setScratchBufferAllocator:)]
pub unsafe fn setScratchBufferAllocator(
&self,
scratch_buffer_allocator: Option<&ProtocolObject<dyn MTLIOScratchBufferAllocator>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLIOCommandQueueDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLIOFileHandle: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
}
unsafe impl ProtocolType for dyn MTLIOFileHandle {}
);

View File

@@ -0,0 +1,53 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIOCompressionStatus(pub NSInteger);
impl MTLIOCompressionStatus {
#[doc(alias = "MTLIOCompressionStatusComplete")]
pub const Complete: Self = Self(0);
#[doc(alias = "MTLIOCompressionStatusError")]
pub const Error: Self = Self(1);
}
unsafe impl Encode for MTLIOCompressionStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLIOCompressionStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type MTLIOCompressionContext = *mut c_void;
extern "C" {
pub fn MTLIOCompressionContextDefaultChunkSize() -> usize;
}
extern "C" {
#[cfg(feature = "MTLDevice")]
pub fn MTLIOCreateCompressionContext(
path: NonNull<c_char>,
r#type: MTLIOCompressionMethod,
chunk_size: usize,
) -> MTLIOCompressionContext;
}
extern "C" {
pub fn MTLIOCompressionContextAppendData(
context: MTLIOCompressionContext,
data: NonNull<c_void>,
size: usize,
);
}
extern "C" {
pub fn MTLIOFlushAndDestroyCompressionContext(
context: MTLIOCompressionContext,
) -> MTLIOCompressionStatus;
}

View File

@@ -0,0 +1,198 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIndirectCommandType(pub NSUInteger);
bitflags::bitflags! {
impl MTLIndirectCommandType: NSUInteger {
#[doc(alias = "MTLIndirectCommandTypeDraw")]
const Draw = 1<<0;
#[doc(alias = "MTLIndirectCommandTypeDrawIndexed")]
const DrawIndexed = 1<<1;
#[doc(alias = "MTLIndirectCommandTypeDrawPatches")]
const DrawPatches = 1<<2;
#[doc(alias = "MTLIndirectCommandTypeDrawIndexedPatches")]
const DrawIndexedPatches = 1<<3;
#[doc(alias = "MTLIndirectCommandTypeConcurrentDispatch")]
const ConcurrentDispatch = 1<<5;
#[doc(alias = "MTLIndirectCommandTypeConcurrentDispatchThreads")]
const ConcurrentDispatchThreads = 1<<6;
#[doc(alias = "MTLIndirectCommandTypeDrawMeshThreadgroups")]
const DrawMeshThreadgroups = 1<<7;
#[doc(alias = "MTLIndirectCommandTypeDrawMeshThreads")]
const DrawMeshThreads = 1<<8;
}
}
unsafe impl Encode for MTLIndirectCommandType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLIndirectCommandType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLIndirectCommandBufferExecutionRange {
pub location: u32,
pub length: u32,
}
unsafe impl Encode for MTLIndirectCommandBufferExecutionRange {
const ENCODING: Encoding = Encoding::Struct("?", &[<u32>::ENCODING, <u32>::ENCODING]);
}
unsafe impl RefEncode for MTLIndirectCommandBufferExecutionRange {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLIndirectCommandBufferExecutionRangeMake(location: u32,length: u32,) -> MTLIndirectCommandBufferExecutionRange;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLIndirectCommandBufferDescriptor;
unsafe impl ClassType for MTLIndirectCommandBufferDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLIndirectCommandBufferDescriptor {}
unsafe impl NSObjectProtocol for MTLIndirectCommandBufferDescriptor {}
extern_methods!(
unsafe impl MTLIndirectCommandBufferDescriptor {
#[method(commandTypes)]
pub fn commandTypes(&self) -> MTLIndirectCommandType;
#[method(setCommandTypes:)]
pub fn setCommandTypes(&self, command_types: MTLIndirectCommandType);
#[method(inheritPipelineState)]
pub fn inheritPipelineState(&self) -> bool;
#[method(setInheritPipelineState:)]
pub fn setInheritPipelineState(&self, inherit_pipeline_state: bool);
#[method(inheritBuffers)]
pub fn inheritBuffers(&self) -> bool;
#[method(setInheritBuffers:)]
pub fn setInheritBuffers(&self, inherit_buffers: bool);
#[method(maxVertexBufferBindCount)]
pub fn maxVertexBufferBindCount(&self) -> NSUInteger;
#[method(setMaxVertexBufferBindCount:)]
pub fn setMaxVertexBufferBindCount(&self, max_vertex_buffer_bind_count: NSUInteger);
#[method(maxFragmentBufferBindCount)]
pub fn maxFragmentBufferBindCount(&self) -> NSUInteger;
#[method(setMaxFragmentBufferBindCount:)]
pub fn setMaxFragmentBufferBindCount(&self, max_fragment_buffer_bind_count: NSUInteger);
#[method(maxKernelBufferBindCount)]
pub fn maxKernelBufferBindCount(&self) -> NSUInteger;
#[method(setMaxKernelBufferBindCount:)]
pub fn setMaxKernelBufferBindCount(&self, max_kernel_buffer_bind_count: NSUInteger);
#[method(maxKernelThreadgroupMemoryBindCount)]
pub unsafe fn maxKernelThreadgroupMemoryBindCount(&self) -> NSUInteger;
#[method(setMaxKernelThreadgroupMemoryBindCount:)]
pub unsafe fn setMaxKernelThreadgroupMemoryBindCount(
&self,
max_kernel_threadgroup_memory_bind_count: NSUInteger,
);
#[method(maxObjectBufferBindCount)]
pub unsafe fn maxObjectBufferBindCount(&self) -> NSUInteger;
#[method(setMaxObjectBufferBindCount:)]
pub unsafe fn setMaxObjectBufferBindCount(&self, max_object_buffer_bind_count: NSUInteger);
#[method(maxMeshBufferBindCount)]
pub unsafe fn maxMeshBufferBindCount(&self) -> NSUInteger;
#[method(setMaxMeshBufferBindCount:)]
pub unsafe fn setMaxMeshBufferBindCount(&self, max_mesh_buffer_bind_count: NSUInteger);
#[method(maxObjectThreadgroupMemoryBindCount)]
pub unsafe fn maxObjectThreadgroupMemoryBindCount(&self) -> NSUInteger;
#[method(setMaxObjectThreadgroupMemoryBindCount:)]
pub unsafe fn setMaxObjectThreadgroupMemoryBindCount(
&self,
max_object_threadgroup_memory_bind_count: NSUInteger,
);
#[method(supportRayTracing)]
pub unsafe fn supportRayTracing(&self) -> bool;
#[method(setSupportRayTracing:)]
pub unsafe fn setSupportRayTracing(&self, support_ray_tracing: bool);
#[method(supportDynamicAttributeStride)]
pub unsafe fn supportDynamicAttributeStride(&self) -> bool;
#[method(setSupportDynamicAttributeStride:)]
pub unsafe fn setSupportDynamicAttributeStride(
&self,
support_dynamic_attribute_stride: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLIndirectCommandBufferDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
#[cfg(feature = "MTLResource")]
pub unsafe trait MTLIndirectCommandBuffer: MTLResource + IsRetainable {
#[method(size)]
fn size(&self) -> NSUInteger;
#[cfg(feature = "MTLTypes")]
#[method(gpuResourceID)]
unsafe fn gpuResourceID(&self) -> MTLResourceID;
#[method(resetWithRange:)]
unsafe fn resetWithRange(&self, range: NSRange);
#[cfg(feature = "MTLIndirectCommandEncoder")]
#[method_id(@__retain_semantics Other indirectRenderCommandAtIndex:)]
unsafe fn indirectRenderCommandAtIndex(
&self,
command_index: NSUInteger,
) -> Retained<ProtocolObject<dyn MTLIndirectRenderCommand>>;
#[cfg(feature = "MTLIndirectCommandEncoder")]
#[method_id(@__retain_semantics Other indirectComputeCommandAtIndex:)]
unsafe fn indirectComputeCommandAtIndex(
&self,
command_index: NSUInteger,
) -> Retained<ProtocolObject<dyn MTLIndirectComputeCommand>>;
}
#[cfg(feature = "MTLResource")]
unsafe impl ProtocolType for dyn MTLIndirectCommandBuffer {}
);

View File

@@ -0,0 +1,229 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
pub unsafe trait MTLIndirectRenderCommand: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLRenderPipeline")]
#[method(setRenderPipelineState:)]
unsafe fn setRenderPipelineState(
&self,
pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setVertexBuffer:offset:atIndex:)]
unsafe fn setVertexBuffer_offset_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setFragmentBuffer:offset:atIndex:)]
unsafe fn setFragmentBuffer_offset_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setVertexBuffer:offset:attributeStride:atIndex:)]
unsafe fn setVertexBuffer_offset_attributeStride_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
stride: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)]
unsafe fn drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride(
&self,
number_of_patch_control_points: NSUInteger,
patch_start: NSUInteger,
patch_count: NSUInteger,
patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
patch_index_buffer_offset: NSUInteger,
instance_count: NSUInteger,
base_instance: NSUInteger,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
instance_stride: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)]
unsafe fn drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride(
&self,
number_of_patch_control_points: NSUInteger,
patch_start: NSUInteger,
patch_count: NSUInteger,
patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
patch_index_buffer_offset: NSUInteger,
control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
control_point_index_buffer_offset: NSUInteger,
instance_count: NSUInteger,
base_instance: NSUInteger,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
instance_stride: NSUInteger,
);
#[cfg(feature = "MTLRenderCommandEncoder")]
#[method(drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:)]
unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
&self,
primitive_type: MTLPrimitiveType,
vertex_start: NSUInteger,
vertex_count: NSUInteger,
instance_count: NSUInteger,
base_instance: NSUInteger,
);
#[cfg(all(
feature = "MTLBuffer",
feature = "MTLRenderCommandEncoder",
feature = "MTLResource",
feature = "MTLStageInputOutputDescriptor"
))]
#[method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:)]
unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance(
&self,
primitive_type: MTLPrimitiveType,
index_count: NSUInteger,
index_type: MTLIndexType,
index_buffer: &ProtocolObject<dyn MTLBuffer>,
index_buffer_offset: NSUInteger,
instance_count: NSUInteger,
base_vertex: NSInteger,
base_instance: NSUInteger,
);
#[method(setObjectThreadgroupMemoryLength:atIndex:)]
unsafe fn setObjectThreadgroupMemoryLength_atIndex(
&self,
length: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setObjectBuffer:offset:atIndex:)]
unsafe fn setObjectBuffer_offset_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setMeshBuffer:offset:atIndex:)]
unsafe fn setMeshBuffer_offset_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)]
unsafe fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
threadgroups_per_grid: MTLSize,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
);
#[cfg(feature = "MTLTypes")]
#[method(drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)]
unsafe fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
&self,
threads_per_grid: MTLSize,
threads_per_object_threadgroup: MTLSize,
threads_per_mesh_threadgroup: MTLSize,
);
#[method(setBarrier)]
unsafe fn setBarrier(&self);
#[method(clearBarrier)]
unsafe fn clearBarrier(&self);
#[method(reset)]
unsafe fn reset(&self);
}
unsafe impl ProtocolType for dyn MTLIndirectRenderCommand {}
);
extern_protocol!(
pub unsafe trait MTLIndirectComputeCommand: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLComputePipeline")]
#[method(setComputePipelineState:)]
unsafe fn setComputePipelineState(
&self,
pipeline_state: &ProtocolObject<dyn MTLComputePipelineState>,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setKernelBuffer:offset:atIndex:)]
unsafe fn setKernelBuffer_offset_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setKernelBuffer:offset:attributeStride:atIndex:)]
unsafe fn setKernelBuffer_offset_attributeStride_atIndex(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
stride: NSUInteger,
index: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(concurrentDispatchThreadgroups:threadsPerThreadgroup:)]
unsafe fn concurrentDispatchThreadgroups_threadsPerThreadgroup(
&self,
threadgroups_per_grid: MTLSize,
threads_per_threadgroup: MTLSize,
);
#[cfg(feature = "MTLTypes")]
#[method(concurrentDispatchThreads:threadsPerThreadgroup:)]
unsafe fn concurrentDispatchThreads_threadsPerThreadgroup(
&self,
threads_per_grid: MTLSize,
threads_per_threadgroup: MTLSize,
);
#[method(setBarrier)]
unsafe fn setBarrier(&self);
#[method(clearBarrier)]
unsafe fn clearBarrier(&self);
#[method(setImageblockWidth:height:)]
unsafe fn setImageblockWidth_height(&self, width: NSUInteger, height: NSUInteger);
#[method(reset)]
unsafe fn reset(&self);
#[method(setThreadgroupMemoryLength:atIndex:)]
unsafe fn setThreadgroupMemoryLength_atIndex(&self, length: NSUInteger, index: NSUInteger);
#[cfg(feature = "MTLTypes")]
#[method(setStageInRegion:)]
unsafe fn setStageInRegion(&self, region: MTLRegion);
}
unsafe impl ProtocolType for dyn MTLIndirectComputeCommand {}
);

View File

@@ -0,0 +1,177 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIntersectionFunctionSignature(pub NSUInteger);
bitflags::bitflags! {
impl MTLIntersectionFunctionSignature: NSUInteger {
#[doc(alias = "MTLIntersectionFunctionSignatureNone")]
const None = 0;
#[doc(alias = "MTLIntersectionFunctionSignatureInstancing")]
const Instancing = 1<<0;
#[doc(alias = "MTLIntersectionFunctionSignatureTriangleData")]
const TriangleData = 1<<1;
#[doc(alias = "MTLIntersectionFunctionSignatureWorldSpaceData")]
const WorldSpaceData = 1<<2;
#[doc(alias = "MTLIntersectionFunctionSignatureInstanceMotion")]
const InstanceMotion = 1<<3;
#[doc(alias = "MTLIntersectionFunctionSignaturePrimitiveMotion")]
const PrimitiveMotion = 1<<4;
#[doc(alias = "MTLIntersectionFunctionSignatureExtendedLimits")]
const ExtendedLimits = 1<<5;
#[doc(alias = "MTLIntersectionFunctionSignatureMaxLevels")]
const MaxLevels = 1<<6;
#[doc(alias = "MTLIntersectionFunctionSignatureCurveData")]
const CurveData = 1<<7;
}
}
unsafe impl Encode for MTLIntersectionFunctionSignature {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLIntersectionFunctionSignature {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLIntersectionFunctionTableDescriptor;
unsafe impl ClassType for MTLIntersectionFunctionTableDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLIntersectionFunctionTableDescriptor {}
unsafe impl NSObjectProtocol for MTLIntersectionFunctionTableDescriptor {}
extern_methods!(
unsafe impl MTLIntersectionFunctionTableDescriptor {
#[method_id(@__retain_semantics Other intersectionFunctionTableDescriptor)]
pub unsafe fn intersectionFunctionTableDescriptor(
) -> Retained<MTLIntersectionFunctionTableDescriptor>;
#[method(functionCount)]
pub unsafe fn functionCount(&self) -> NSUInteger;
#[method(setFunctionCount:)]
pub fn setFunctionCount(&self, function_count: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLIntersectionFunctionTableDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLIntersectionFunctionTableDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
#[cfg(feature = "MTLResource")]
pub unsafe trait MTLIntersectionFunctionTable: MTLResource + IsRetainable {
#[cfg(feature = "MTLBuffer")]
#[method(setBuffer:offset:atIndex:)]
unsafe fn setBuffer_offset_atIndex(
&self,
buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
offset: NSUInteger,
index: NSUInteger,
);
#[cfg(feature = "MTLBuffer")]
#[method(setBuffers:offsets:withRange:)]
unsafe fn setBuffers_offsets_withRange(
&self,
buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
offsets: NonNull<NSUInteger>,
range: NSRange,
);
#[cfg(feature = "MTLTypes")]
#[method(gpuResourceID)]
unsafe fn gpuResourceID(&self) -> MTLResourceID;
#[cfg(feature = "MTLFunctionHandle")]
#[method(setFunction:atIndex:)]
fn setFunction_atIndex(
&self,
function: Option<&ProtocolObject<dyn MTLFunctionHandle>>,
index: NSUInteger,
);
#[cfg(feature = "MTLFunctionHandle")]
#[method(setFunctions:withRange:)]
unsafe fn setFunctions_withRange(
&self,
functions: NonNull<*const ProtocolObject<dyn MTLFunctionHandle>>,
range: NSRange,
);
#[method(setOpaqueTriangleIntersectionFunctionWithSignature:atIndex:)]
unsafe fn setOpaqueTriangleIntersectionFunctionWithSignature_atIndex(
&self,
signature: MTLIntersectionFunctionSignature,
index: NSUInteger,
);
#[method(setOpaqueTriangleIntersectionFunctionWithSignature:withRange:)]
unsafe fn setOpaqueTriangleIntersectionFunctionWithSignature_withRange(
&self,
signature: MTLIntersectionFunctionSignature,
range: NSRange,
);
#[method(setOpaqueCurveIntersectionFunctionWithSignature:atIndex:)]
unsafe fn setOpaqueCurveIntersectionFunctionWithSignature_atIndex(
&self,
signature: MTLIntersectionFunctionSignature,
index: NSUInteger,
);
#[method(setOpaqueCurveIntersectionFunctionWithSignature:withRange:)]
unsafe fn setOpaqueCurveIntersectionFunctionWithSignature_withRange(
&self,
signature: MTLIntersectionFunctionSignature,
range: NSRange,
);
#[cfg(feature = "MTLVisibleFunctionTable")]
#[method(setVisibleFunctionTable:atBufferIndex:)]
unsafe fn setVisibleFunctionTable_atBufferIndex(
&self,
function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
buffer_index: NSUInteger,
);
#[cfg(feature = "MTLVisibleFunctionTable")]
#[method(setVisibleFunctionTables:withBufferRange:)]
unsafe fn setVisibleFunctionTables_withBufferRange(
&self,
function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
buffer_range: NSRange,
);
}
#[cfg(feature = "MTLResource")]
unsafe impl ProtocolType for dyn MTLIntersectionFunctionTable {}
);

View File

@@ -0,0 +1,556 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[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!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexAttribute;
unsafe impl ClassType for MTLVertexAttribute {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLVertexAttribute {}
extern_methods!(
unsafe impl MTLVertexAttribute {
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Retained<NSString>;
#[method(attributeIndex)]
pub fn attributeIndex(&self) -> NSUInteger;
#[cfg(feature = "MTLArgument")]
#[method(attributeType)]
pub fn attributeType(&self) -> MTLDataType;
#[method(isActive)]
pub fn isActive(&self) -> bool;
#[method(isPatchData)]
pub fn isPatchData(&self) -> bool;
#[method(isPatchControlPointData)]
pub fn isPatchControlPointData(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVertexAttribute {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAttribute;
unsafe impl ClassType for MTLAttribute {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLAttribute {}
extern_methods!(
unsafe impl MTLAttribute {
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Retained<NSString>;
#[method(attributeIndex)]
pub fn attributeIndex(&self) -> NSUInteger;
#[cfg(feature = "MTLArgument")]
#[method(attributeType)]
pub fn attributeType(&self) -> MTLDataType;
#[method(isActive)]
pub fn isActive(&self) -> bool;
#[method(isPatchData)]
pub fn isPatchData(&self) -> bool;
#[method(isPatchControlPointData)]
pub fn isPatchControlPointData(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLAttribute {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
// NS_ENUM
#[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!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionConstant;
unsafe impl ClassType for MTLFunctionConstant {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLFunctionConstant {}
extern_methods!(
unsafe impl MTLFunctionConstant {
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Retained<NSString>;
#[cfg(feature = "MTLArgument")]
#[method(type)]
pub unsafe fn r#type(&self) -> MTLDataType;
#[method(index)]
pub fn index(&self) -> NSUInteger;
#[method(required)]
pub fn required(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLFunctionConstant {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLFunction: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method(functionType)]
fn functionType(&self) -> MTLFunctionType;
#[method(patchType)]
fn patchType(&self) -> MTLPatchType;
#[method(patchControlPointCount)]
fn patchControlPointCount(&self) -> NSInteger;
#[method_id(@__retain_semantics Other vertexAttributes)]
fn vertexAttributes(&self) -> Option<Retained<NSArray<MTLVertexAttribute>>>;
#[method_id(@__retain_semantics Other stageInputAttributes)]
fn stageInputAttributes(&self) -> Option<Retained<NSArray<MTLAttribute>>>;
#[method_id(@__retain_semantics Other name)]
fn name(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other functionConstantsDictionary)]
fn functionConstantsDictionary(
&self,
) -> Retained<NSDictionary<NSString, MTLFunctionConstant>>;
#[cfg(feature = "MTLArgumentEncoder")]
#[method_id(@__retain_semantics New newArgumentEncoderWithBufferIndex:)]
unsafe fn newArgumentEncoderWithBufferIndex(
&self,
buffer_index: NSUInteger,
) -> Retained<ProtocolObject<dyn MTLArgumentEncoder>>;
#[cfg(feature = "MTLFunctionDescriptor")]
#[method(options)]
fn options(&self) -> MTLFunctionOptions;
}
unsafe impl ProtocolType for dyn MTLFunction {}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLLanguageVersion(pub NSUInteger);
impl MTLLanguageVersion {
#[deprecated = "Use a newer language standard"]
pub const MTLLanguageVersion1_0: Self = Self(1 << 16);
pub const MTLLanguageVersion1_1: Self = Self((1 << 16) + 1);
pub const MTLLanguageVersion1_2: Self = Self((1 << 16) + 2);
pub const MTLLanguageVersion2_0: Self = Self(2 << 16);
pub const MTLLanguageVersion2_1: Self = Self((2 << 16) + 1);
pub const MTLLanguageVersion2_2: Self = Self((2 << 16) + 2);
pub const MTLLanguageVersion2_3: Self = Self((2 << 16) + 3);
pub const MTLLanguageVersion2_4: Self = Self((2 << 16) + 4);
pub const MTLLanguageVersion3_0: Self = Self((3 << 16) + 0);
pub const MTLLanguageVersion3_1: Self = Self((3 << 16) + 1);
}
unsafe impl Encode for MTLLanguageVersion {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLLanguageVersion {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[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);
}
// NS_ENUM
#[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);
}
// NS_ENUM
#[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);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLCompileOptions;
unsafe impl ClassType for MTLCompileOptions {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLCompileOptions {}
unsafe impl NSObjectProtocol for MTLCompileOptions {}
extern_methods!(
unsafe impl MTLCompileOptions {
#[method_id(@__retain_semantics Other preprocessorMacros)]
pub fn preprocessorMacros(&self) -> Option<Retained<NSDictionary<NSString, NSObject>>>;
#[method(setPreprocessorMacros:)]
pub unsafe fn setPreprocessorMacros(
&self,
preprocessor_macros: Option<&NSDictionary<NSString, NSObject>>,
);
#[method(fastMathEnabled)]
pub fn fastMathEnabled(&self) -> bool;
#[method(setFastMathEnabled:)]
pub fn setFastMathEnabled(&self, fast_math_enabled: bool);
#[method(languageVersion)]
pub fn languageVersion(&self) -> MTLLanguageVersion;
#[method(setLanguageVersion:)]
pub fn setLanguageVersion(&self, language_version: MTLLanguageVersion);
#[method(libraryType)]
pub fn libraryType(&self) -> MTLLibraryType;
#[method(setLibraryType:)]
pub fn setLibraryType(&self, library_type: MTLLibraryType);
#[method_id(@__retain_semantics Other installName)]
pub fn installName(&self) -> Option<Retained<NSString>>;
#[method(setInstallName:)]
pub unsafe fn setInstallName(&self, install_name: Option<&NSString>);
#[cfg(feature = "MTLDynamicLibrary")]
#[method_id(@__retain_semantics Other libraries)]
pub fn libraries(&self)
-> Option<Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>>;
#[cfg(feature = "MTLDynamicLibrary")]
#[method(setLibraries:)]
pub fn setLibraries(
&self,
libraries: Option<&NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>,
);
#[method(preserveInvariance)]
pub fn preserveInvariance(&self) -> bool;
#[method(setPreserveInvariance:)]
pub fn setPreserveInvariance(&self, preserve_invariance: bool);
#[method(optimizationLevel)]
pub unsafe fn optimizationLevel(&self) -> MTLLibraryOptimizationLevel;
#[method(setOptimizationLevel:)]
pub unsafe fn setOptimizationLevel(&self, optimization_level: MTLLibraryOptimizationLevel);
#[method(compileSymbolVisibility)]
pub unsafe fn compileSymbolVisibility(&self) -> MTLCompileSymbolVisibility;
#[method(setCompileSymbolVisibility:)]
pub unsafe fn setCompileSymbolVisibility(
&self,
compile_symbol_visibility: MTLCompileSymbolVisibility,
);
#[method(allowReferencingUndefinedSymbols)]
pub unsafe fn allowReferencingUndefinedSymbols(&self) -> bool;
#[method(setAllowReferencingUndefinedSymbols:)]
pub unsafe fn setAllowReferencingUndefinedSymbols(
&self,
allow_referencing_undefined_symbols: bool,
);
#[method(maxTotalThreadsPerThreadgroup)]
pub unsafe fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
#[method(setMaxTotalThreadsPerThreadgroup:)]
pub unsafe fn setMaxTotalThreadsPerThreadgroup(
&self,
max_total_threads_per_threadgroup: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLCompileOptions {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLCompileOptions {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern "C" {
pub static MTLLibraryErrorDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[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 + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics New newFunctionWithName:)]
fn newFunctionWithName(
&self,
function_name: &NSString,
) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLFunctionConstantValues")]
#[method_id(@__retain_semantics New newFunctionWithName:constantValues:error:_)]
fn newFunctionWithName_constantValues_error(
&self,
name: &NSString,
constant_values: &MTLFunctionConstantValues,
) -> Result<Retained<ProtocolObject<dyn MTLFunction>>, Retained<NSError>>;
#[cfg(all(feature = "MTLFunctionConstantValues", feature = "block2"))]
#[method(newFunctionWithName:constantValues:completionHandler:)]
unsafe fn newFunctionWithName_constantValues_completionHandler(
&self,
name: &NSString,
constant_values: &MTLFunctionConstantValues,
completion_handler: &block2::Block<
dyn Fn(*mut ProtocolObject<dyn MTLFunction>, *mut NSError),
>,
);
#[cfg(all(feature = "MTLFunctionDescriptor", feature = "block2"))]
#[method(newFunctionWithDescriptor:completionHandler:)]
unsafe fn newFunctionWithDescriptor_completionHandler(
&self,
descriptor: &MTLFunctionDescriptor,
completion_handler: &block2::Block<
dyn Fn(*mut ProtocolObject<dyn MTLFunction>, *mut NSError),
>,
);
#[cfg(feature = "MTLFunctionDescriptor")]
#[method_id(@__retain_semantics New newFunctionWithDescriptor:error:_)]
fn newFunctionWithDescriptor_error(
&self,
descriptor: &MTLFunctionDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLFunction>>, Retained<NSError>>;
#[cfg(all(feature = "MTLFunctionDescriptor", feature = "block2"))]
#[method(newIntersectionFunctionWithDescriptor:completionHandler:)]
unsafe fn newIntersectionFunctionWithDescriptor_completionHandler(
&self,
descriptor: &MTLIntersectionFunctionDescriptor,
completion_handler: &block2::Block<
dyn Fn(*mut ProtocolObject<dyn MTLFunction>, *mut NSError),
>,
);
#[cfg(feature = "MTLFunctionDescriptor")]
#[method_id(@__retain_semantics New newIntersectionFunctionWithDescriptor:error:_)]
fn newIntersectionFunctionWithDescriptor_error(
&self,
descriptor: &MTLIntersectionFunctionDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLFunction>>, Retained<NSError>>;
#[method_id(@__retain_semantics Other functionNames)]
fn functionNames(&self) -> Retained<NSArray<NSString>>;
#[method(type)]
unsafe fn r#type(&self) -> MTLLibraryType;
#[method_id(@__retain_semantics Other installName)]
fn installName(&self) -> Option<Retained<NSString>>;
}
unsafe impl ProtocolType for dyn MTLLibrary {}
);

View File

@@ -0,0 +1,91 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLLinkedFunctions;
unsafe impl ClassType for MTLLinkedFunctions {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLLinkedFunctions {}
unsafe impl NSObjectProtocol for MTLLinkedFunctions {}
extern_methods!(
unsafe impl MTLLinkedFunctions {
#[method_id(@__retain_semantics Other linkedFunctions)]
pub fn linkedFunctions() -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other functions)]
pub fn functions(&self) -> Option<Retained<NSArray<ProtocolObject<dyn MTLFunction>>>>;
#[cfg(feature = "MTLLibrary")]
#[method(setFunctions:)]
pub fn setFunctions(&self, functions: Option<&NSArray<ProtocolObject<dyn MTLFunction>>>);
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other binaryFunctions)]
pub fn binaryFunctions(&self)
-> Option<Retained<NSArray<ProtocolObject<dyn MTLFunction>>>>;
#[cfg(feature = "MTLLibrary")]
#[method(setBinaryFunctions:)]
pub fn setBinaryFunctions(
&self,
binary_functions: Option<&NSArray<ProtocolObject<dyn MTLFunction>>>,
);
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other groups)]
pub fn groups(
&self,
) -> Option<Retained<NSDictionary<NSString, NSArray<ProtocolObject<dyn MTLFunction>>>>>;
#[cfg(feature = "MTLLibrary")]
#[method(setGroups:)]
pub fn setGroups(
&self,
groups: Option<&NSDictionary<NSString, NSArray<ProtocolObject<dyn MTLFunction>>>>,
);
#[cfg(feature = "MTLLibrary")]
#[method_id(@__retain_semantics Other privateFunctions)]
pub fn privateFunctions(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLFunction>>>>;
#[cfg(feature = "MTLLibrary")]
#[method(setPrivateFunctions:)]
pub fn setPrivateFunctions(
&self,
private_functions: Option<&NSArray<ProtocolObject<dyn MTLFunction>>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLLinkedFunctions {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLLinkedFunctions {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}

View File

@@ -0,0 +1,53 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
#[cfg(feature = "MTLCommandEncoder")]
pub unsafe trait MTLParallelRenderCommandEncoder:
MTLCommandEncoder + IsRetainable
{
#[cfg(feature = "MTLRenderCommandEncoder")]
#[method_id(@__retain_semantics Other renderCommandEncoder)]
fn renderCommandEncoder(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLRenderCommandEncoder>>>;
#[cfg(feature = "MTLRenderPass")]
#[method(setColorStoreAction:atIndex:)]
unsafe fn setColorStoreAction_atIndex(
&self,
store_action: MTLStoreAction,
color_attachment_index: NSUInteger,
);
#[cfg(feature = "MTLRenderPass")]
#[method(setDepthStoreAction:)]
unsafe fn setDepthStoreAction(&self, store_action: MTLStoreAction);
#[cfg(feature = "MTLRenderPass")]
#[method(setStencilStoreAction:)]
unsafe fn setStencilStoreAction(&self, store_action: MTLStoreAction);
#[cfg(feature = "MTLRenderPass")]
#[method(setColorStoreActionOptions:atIndex:)]
unsafe fn setColorStoreActionOptions_atIndex(
&self,
store_action_options: MTLStoreActionOptions,
color_attachment_index: NSUInteger,
);
#[cfg(feature = "MTLRenderPass")]
#[method(setDepthStoreActionOptions:)]
unsafe fn setDepthStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);
#[cfg(feature = "MTLRenderPass")]
#[method(setStencilStoreActionOptions:)]
unsafe fn setStencilStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);
}
#[cfg(feature = "MTLCommandEncoder")]
unsafe impl ProtocolType for dyn MTLParallelRenderCommandEncoder {}
);

View File

@@ -0,0 +1,102 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLMutability(pub NSUInteger);
impl MTLMutability {
#[doc(alias = "MTLMutabilityDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "MTLMutabilityMutable")]
pub const Mutable: Self = Self(1);
#[doc(alias = "MTLMutabilityImmutable")]
pub const Immutable: Self = Self(2);
}
unsafe impl Encode for MTLMutability {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLMutability {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLPipelineBufferDescriptor;
unsafe impl ClassType for MTLPipelineBufferDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLPipelineBufferDescriptor {}
unsafe impl NSObjectProtocol for MTLPipelineBufferDescriptor {}
extern_methods!(
unsafe impl MTLPipelineBufferDescriptor {
#[method(mutability)]
pub fn mutability(&self) -> MTLMutability;
#[method(setMutability:)]
pub fn setMutability(&self, mutability: MTLMutability);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLPipelineBufferDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLPipelineBufferDescriptorArray;
unsafe impl ClassType for MTLPipelineBufferDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLPipelineBufferDescriptorArray {}
extern_methods!(
unsafe impl MTLPipelineBufferDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
buffer_index: NSUInteger,
) -> Retained<MTLPipelineBufferDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
buffer: Option<&MTLPipelineBufferDescriptor>,
buffer_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLPipelineBufferDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,298 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLPixelFormat(pub NSUInteger);
impl MTLPixelFormat {
#[doc(alias = "MTLPixelFormatInvalid")]
pub const Invalid: Self = Self(0);
#[doc(alias = "MTLPixelFormatA8Unorm")]
pub const A8Unorm: Self = Self(1);
#[doc(alias = "MTLPixelFormatR8Unorm")]
pub const R8Unorm: Self = Self(10);
#[doc(alias = "MTLPixelFormatR8Unorm_sRGB")]
pub const R8Unorm_sRGB: Self = Self(11);
#[doc(alias = "MTLPixelFormatR8Snorm")]
pub const R8Snorm: Self = Self(12);
#[doc(alias = "MTLPixelFormatR8Uint")]
pub const R8Uint: Self = Self(13);
#[doc(alias = "MTLPixelFormatR8Sint")]
pub const R8Sint: Self = Self(14);
#[doc(alias = "MTLPixelFormatR16Unorm")]
pub const R16Unorm: Self = Self(20);
#[doc(alias = "MTLPixelFormatR16Snorm")]
pub const R16Snorm: Self = Self(22);
#[doc(alias = "MTLPixelFormatR16Uint")]
pub const R16Uint: Self = Self(23);
#[doc(alias = "MTLPixelFormatR16Sint")]
pub const R16Sint: Self = Self(24);
#[doc(alias = "MTLPixelFormatR16Float")]
pub const R16Float: Self = Self(25);
#[doc(alias = "MTLPixelFormatRG8Unorm")]
pub const RG8Unorm: Self = Self(30);
#[doc(alias = "MTLPixelFormatRG8Unorm_sRGB")]
pub const RG8Unorm_sRGB: Self = Self(31);
#[doc(alias = "MTLPixelFormatRG8Snorm")]
pub const RG8Snorm: Self = Self(32);
#[doc(alias = "MTLPixelFormatRG8Uint")]
pub const RG8Uint: Self = Self(33);
#[doc(alias = "MTLPixelFormatRG8Sint")]
pub const RG8Sint: Self = Self(34);
#[doc(alias = "MTLPixelFormatB5G6R5Unorm")]
pub const B5G6R5Unorm: Self = Self(40);
#[doc(alias = "MTLPixelFormatA1BGR5Unorm")]
pub const A1BGR5Unorm: Self = Self(41);
#[doc(alias = "MTLPixelFormatABGR4Unorm")]
pub const ABGR4Unorm: Self = Self(42);
#[doc(alias = "MTLPixelFormatBGR5A1Unorm")]
pub const BGR5A1Unorm: Self = Self(43);
#[doc(alias = "MTLPixelFormatR32Uint")]
pub const R32Uint: Self = Self(53);
#[doc(alias = "MTLPixelFormatR32Sint")]
pub const R32Sint: Self = Self(54);
#[doc(alias = "MTLPixelFormatR32Float")]
pub const R32Float: Self = Self(55);
#[doc(alias = "MTLPixelFormatRG16Unorm")]
pub const RG16Unorm: Self = Self(60);
#[doc(alias = "MTLPixelFormatRG16Snorm")]
pub const RG16Snorm: Self = Self(62);
#[doc(alias = "MTLPixelFormatRG16Uint")]
pub const RG16Uint: Self = Self(63);
#[doc(alias = "MTLPixelFormatRG16Sint")]
pub const RG16Sint: Self = Self(64);
#[doc(alias = "MTLPixelFormatRG16Float")]
pub const RG16Float: Self = Self(65);
#[doc(alias = "MTLPixelFormatRGBA8Unorm")]
pub const RGBA8Unorm: Self = Self(70);
#[doc(alias = "MTLPixelFormatRGBA8Unorm_sRGB")]
pub const RGBA8Unorm_sRGB: Self = Self(71);
#[doc(alias = "MTLPixelFormatRGBA8Snorm")]
pub const RGBA8Snorm: Self = Self(72);
#[doc(alias = "MTLPixelFormatRGBA8Uint")]
pub const RGBA8Uint: Self = Self(73);
#[doc(alias = "MTLPixelFormatRGBA8Sint")]
pub const RGBA8Sint: Self = Self(74);
#[doc(alias = "MTLPixelFormatBGRA8Unorm")]
pub const BGRA8Unorm: Self = Self(80);
#[doc(alias = "MTLPixelFormatBGRA8Unorm_sRGB")]
pub const BGRA8Unorm_sRGB: Self = Self(81);
#[doc(alias = "MTLPixelFormatRGB10A2Unorm")]
pub const RGB10A2Unorm: Self = Self(90);
#[doc(alias = "MTLPixelFormatRGB10A2Uint")]
pub const RGB10A2Uint: Self = Self(91);
#[doc(alias = "MTLPixelFormatRG11B10Float")]
pub const RG11B10Float: Self = Self(92);
#[doc(alias = "MTLPixelFormatRGB9E5Float")]
pub const RGB9E5Float: Self = Self(93);
#[doc(alias = "MTLPixelFormatBGR10A2Unorm")]
pub const BGR10A2Unorm: Self = Self(94);
#[doc(alias = "MTLPixelFormatBGR10_XR")]
pub const BGR10_XR: Self = Self(554);
#[doc(alias = "MTLPixelFormatBGR10_XR_sRGB")]
pub const BGR10_XR_sRGB: Self = Self(555);
#[doc(alias = "MTLPixelFormatRG32Uint")]
pub const RG32Uint: Self = Self(103);
#[doc(alias = "MTLPixelFormatRG32Sint")]
pub const RG32Sint: Self = Self(104);
#[doc(alias = "MTLPixelFormatRG32Float")]
pub const RG32Float: Self = Self(105);
#[doc(alias = "MTLPixelFormatRGBA16Unorm")]
pub const RGBA16Unorm: Self = Self(110);
#[doc(alias = "MTLPixelFormatRGBA16Snorm")]
pub const RGBA16Snorm: Self = Self(112);
#[doc(alias = "MTLPixelFormatRGBA16Uint")]
pub const RGBA16Uint: Self = Self(113);
#[doc(alias = "MTLPixelFormatRGBA16Sint")]
pub const RGBA16Sint: Self = Self(114);
#[doc(alias = "MTLPixelFormatRGBA16Float")]
pub const RGBA16Float: Self = Self(115);
#[doc(alias = "MTLPixelFormatBGRA10_XR")]
pub const BGRA10_XR: Self = Self(552);
#[doc(alias = "MTLPixelFormatBGRA10_XR_sRGB")]
pub const BGRA10_XR_sRGB: Self = Self(553);
#[doc(alias = "MTLPixelFormatRGBA32Uint")]
pub const RGBA32Uint: Self = Self(123);
#[doc(alias = "MTLPixelFormatRGBA32Sint")]
pub const RGBA32Sint: Self = Self(124);
#[doc(alias = "MTLPixelFormatRGBA32Float")]
pub const RGBA32Float: Self = Self(125);
#[doc(alias = "MTLPixelFormatBC1_RGBA")]
pub const BC1_RGBA: Self = Self(130);
#[doc(alias = "MTLPixelFormatBC1_RGBA_sRGB")]
pub const BC1_RGBA_sRGB: Self = Self(131);
#[doc(alias = "MTLPixelFormatBC2_RGBA")]
pub const BC2_RGBA: Self = Self(132);
#[doc(alias = "MTLPixelFormatBC2_RGBA_sRGB")]
pub const BC2_RGBA_sRGB: Self = Self(133);
#[doc(alias = "MTLPixelFormatBC3_RGBA")]
pub const BC3_RGBA: Self = Self(134);
#[doc(alias = "MTLPixelFormatBC3_RGBA_sRGB")]
pub const BC3_RGBA_sRGB: Self = Self(135);
#[doc(alias = "MTLPixelFormatBC4_RUnorm")]
pub const BC4_RUnorm: Self = Self(140);
#[doc(alias = "MTLPixelFormatBC4_RSnorm")]
pub const BC4_RSnorm: Self = Self(141);
#[doc(alias = "MTLPixelFormatBC5_RGUnorm")]
pub const BC5_RGUnorm: Self = Self(142);
#[doc(alias = "MTLPixelFormatBC5_RGSnorm")]
pub const BC5_RGSnorm: Self = Self(143);
#[doc(alias = "MTLPixelFormatBC6H_RGBFloat")]
pub const BC6H_RGBFloat: Self = Self(150);
#[doc(alias = "MTLPixelFormatBC6H_RGBUfloat")]
pub const BC6H_RGBUfloat: Self = Self(151);
#[doc(alias = "MTLPixelFormatBC7_RGBAUnorm")]
pub const BC7_RGBAUnorm: Self = Self(152);
#[doc(alias = "MTLPixelFormatBC7_RGBAUnorm_sRGB")]
pub const BC7_RGBAUnorm_sRGB: Self = Self(153);
#[doc(alias = "MTLPixelFormatPVRTC_RGB_2BPP")]
pub const PVRTC_RGB_2BPP: Self = Self(160);
#[doc(alias = "MTLPixelFormatPVRTC_RGB_2BPP_sRGB")]
pub const PVRTC_RGB_2BPP_sRGB: Self = Self(161);
#[doc(alias = "MTLPixelFormatPVRTC_RGB_4BPP")]
pub const PVRTC_RGB_4BPP: Self = Self(162);
#[doc(alias = "MTLPixelFormatPVRTC_RGB_4BPP_sRGB")]
pub const PVRTC_RGB_4BPP_sRGB: Self = Self(163);
#[doc(alias = "MTLPixelFormatPVRTC_RGBA_2BPP")]
pub const PVRTC_RGBA_2BPP: Self = Self(164);
#[doc(alias = "MTLPixelFormatPVRTC_RGBA_2BPP_sRGB")]
pub const PVRTC_RGBA_2BPP_sRGB: Self = Self(165);
#[doc(alias = "MTLPixelFormatPVRTC_RGBA_4BPP")]
pub const PVRTC_RGBA_4BPP: Self = Self(166);
#[doc(alias = "MTLPixelFormatPVRTC_RGBA_4BPP_sRGB")]
pub const PVRTC_RGBA_4BPP_sRGB: Self = Self(167);
#[doc(alias = "MTLPixelFormatEAC_R11Unorm")]
pub const EAC_R11Unorm: Self = Self(170);
#[doc(alias = "MTLPixelFormatEAC_R11Snorm")]
pub const EAC_R11Snorm: Self = Self(172);
#[doc(alias = "MTLPixelFormatEAC_RG11Unorm")]
pub const EAC_RG11Unorm: Self = Self(174);
#[doc(alias = "MTLPixelFormatEAC_RG11Snorm")]
pub const EAC_RG11Snorm: Self = Self(176);
#[doc(alias = "MTLPixelFormatEAC_RGBA8")]
pub const EAC_RGBA8: Self = Self(178);
#[doc(alias = "MTLPixelFormatEAC_RGBA8_sRGB")]
pub const EAC_RGBA8_sRGB: Self = Self(179);
#[doc(alias = "MTLPixelFormatETC2_RGB8")]
pub const ETC2_RGB8: Self = Self(180);
#[doc(alias = "MTLPixelFormatETC2_RGB8_sRGB")]
pub const ETC2_RGB8_sRGB: Self = Self(181);
#[doc(alias = "MTLPixelFormatETC2_RGB8A1")]
pub const ETC2_RGB8A1: Self = Self(182);
#[doc(alias = "MTLPixelFormatETC2_RGB8A1_sRGB")]
pub const ETC2_RGB8A1_sRGB: Self = Self(183);
#[doc(alias = "MTLPixelFormatASTC_4x4_sRGB")]
pub const ASTC_4x4_sRGB: Self = Self(186);
#[doc(alias = "MTLPixelFormatASTC_5x4_sRGB")]
pub const ASTC_5x4_sRGB: Self = Self(187);
#[doc(alias = "MTLPixelFormatASTC_5x5_sRGB")]
pub const ASTC_5x5_sRGB: Self = Self(188);
#[doc(alias = "MTLPixelFormatASTC_6x5_sRGB")]
pub const ASTC_6x5_sRGB: Self = Self(189);
#[doc(alias = "MTLPixelFormatASTC_6x6_sRGB")]
pub const ASTC_6x6_sRGB: Self = Self(190);
#[doc(alias = "MTLPixelFormatASTC_8x5_sRGB")]
pub const ASTC_8x5_sRGB: Self = Self(192);
#[doc(alias = "MTLPixelFormatASTC_8x6_sRGB")]
pub const ASTC_8x6_sRGB: Self = Self(193);
#[doc(alias = "MTLPixelFormatASTC_8x8_sRGB")]
pub const ASTC_8x8_sRGB: Self = Self(194);
#[doc(alias = "MTLPixelFormatASTC_10x5_sRGB")]
pub const ASTC_10x5_sRGB: Self = Self(195);
#[doc(alias = "MTLPixelFormatASTC_10x6_sRGB")]
pub const ASTC_10x6_sRGB: Self = Self(196);
#[doc(alias = "MTLPixelFormatASTC_10x8_sRGB")]
pub const ASTC_10x8_sRGB: Self = Self(197);
#[doc(alias = "MTLPixelFormatASTC_10x10_sRGB")]
pub const ASTC_10x10_sRGB: Self = Self(198);
#[doc(alias = "MTLPixelFormatASTC_12x10_sRGB")]
pub const ASTC_12x10_sRGB: Self = Self(199);
#[doc(alias = "MTLPixelFormatASTC_12x12_sRGB")]
pub const ASTC_12x12_sRGB: Self = Self(200);
#[doc(alias = "MTLPixelFormatASTC_4x4_LDR")]
pub const ASTC_4x4_LDR: Self = Self(204);
#[doc(alias = "MTLPixelFormatASTC_5x4_LDR")]
pub const ASTC_5x4_LDR: Self = Self(205);
#[doc(alias = "MTLPixelFormatASTC_5x5_LDR")]
pub const ASTC_5x5_LDR: Self = Self(206);
#[doc(alias = "MTLPixelFormatASTC_6x5_LDR")]
pub const ASTC_6x5_LDR: Self = Self(207);
#[doc(alias = "MTLPixelFormatASTC_6x6_LDR")]
pub const ASTC_6x6_LDR: Self = Self(208);
#[doc(alias = "MTLPixelFormatASTC_8x5_LDR")]
pub const ASTC_8x5_LDR: Self = Self(210);
#[doc(alias = "MTLPixelFormatASTC_8x6_LDR")]
pub const ASTC_8x6_LDR: Self = Self(211);
#[doc(alias = "MTLPixelFormatASTC_8x8_LDR")]
pub const ASTC_8x8_LDR: Self = Self(212);
#[doc(alias = "MTLPixelFormatASTC_10x5_LDR")]
pub const ASTC_10x5_LDR: Self = Self(213);
#[doc(alias = "MTLPixelFormatASTC_10x6_LDR")]
pub const ASTC_10x6_LDR: Self = Self(214);
#[doc(alias = "MTLPixelFormatASTC_10x8_LDR")]
pub const ASTC_10x8_LDR: Self = Self(215);
#[doc(alias = "MTLPixelFormatASTC_10x10_LDR")]
pub const ASTC_10x10_LDR: Self = Self(216);
#[doc(alias = "MTLPixelFormatASTC_12x10_LDR")]
pub const ASTC_12x10_LDR: Self = Self(217);
#[doc(alias = "MTLPixelFormatASTC_12x12_LDR")]
pub const ASTC_12x12_LDR: Self = Self(218);
#[doc(alias = "MTLPixelFormatASTC_4x4_HDR")]
pub const ASTC_4x4_HDR: Self = Self(222);
#[doc(alias = "MTLPixelFormatASTC_5x4_HDR")]
pub const ASTC_5x4_HDR: Self = Self(223);
#[doc(alias = "MTLPixelFormatASTC_5x5_HDR")]
pub const ASTC_5x5_HDR: Self = Self(224);
#[doc(alias = "MTLPixelFormatASTC_6x5_HDR")]
pub const ASTC_6x5_HDR: Self = Self(225);
#[doc(alias = "MTLPixelFormatASTC_6x6_HDR")]
pub const ASTC_6x6_HDR: Self = Self(226);
#[doc(alias = "MTLPixelFormatASTC_8x5_HDR")]
pub const ASTC_8x5_HDR: Self = Self(228);
#[doc(alias = "MTLPixelFormatASTC_8x6_HDR")]
pub const ASTC_8x6_HDR: Self = Self(229);
#[doc(alias = "MTLPixelFormatASTC_8x8_HDR")]
pub const ASTC_8x8_HDR: Self = Self(230);
#[doc(alias = "MTLPixelFormatASTC_10x5_HDR")]
pub const ASTC_10x5_HDR: Self = Self(231);
#[doc(alias = "MTLPixelFormatASTC_10x6_HDR")]
pub const ASTC_10x6_HDR: Self = Self(232);
#[doc(alias = "MTLPixelFormatASTC_10x8_HDR")]
pub const ASTC_10x8_HDR: Self = Self(233);
#[doc(alias = "MTLPixelFormatASTC_10x10_HDR")]
pub const ASTC_10x10_HDR: Self = Self(234);
#[doc(alias = "MTLPixelFormatASTC_12x10_HDR")]
pub const ASTC_12x10_HDR: Self = Self(235);
#[doc(alias = "MTLPixelFormatASTC_12x12_HDR")]
pub const ASTC_12x12_HDR: Self = Self(236);
#[doc(alias = "MTLPixelFormatGBGR422")]
pub const GBGR422: Self = Self(240);
#[doc(alias = "MTLPixelFormatBGRG422")]
pub const BGRG422: Self = Self(241);
#[doc(alias = "MTLPixelFormatDepth16Unorm")]
pub const Depth16Unorm: Self = Self(250);
#[doc(alias = "MTLPixelFormatDepth32Float")]
pub const Depth32Float: Self = Self(252);
#[doc(alias = "MTLPixelFormatStencil8")]
pub const Stencil8: Self = Self(253);
#[doc(alias = "MTLPixelFormatDepth24Unorm_Stencil8")]
pub const Depth24Unorm_Stencil8: Self = Self(255);
#[doc(alias = "MTLPixelFormatDepth32Float_Stencil8")]
pub const Depth32Float_Stencil8: Self = Self(260);
#[doc(alias = "MTLPixelFormatX32_Stencil8")]
pub const X32_Stencil8: Self = Self(261);
#[doc(alias = "MTLPixelFormatX24_Stencil8")]
pub const X24_Stencil8: Self = Self(262);
}
unsafe impl Encode for MTLPixelFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLPixelFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

View File

@@ -0,0 +1,283 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRasterizationRateSampleArray;
unsafe impl ClassType for MTLRasterizationRateSampleArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLRasterizationRateSampleArray {}
extern_methods!(
unsafe impl MTLRasterizationRateSampleArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(&self, index: NSUInteger) -> Retained<NSNumber>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(&self, value: &NSNumber, index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRasterizationRateSampleArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRasterizationRateLayerDescriptor;
unsafe impl ClassType for MTLRasterizationRateLayerDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRasterizationRateLayerDescriptor {}
unsafe impl NSObjectProtocol for MTLRasterizationRateLayerDescriptor {}
extern_methods!(
unsafe impl MTLRasterizationRateLayerDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "MTLTypes")]
#[method_id(@__retain_semantics Init initWithSampleCount:)]
pub unsafe fn initWithSampleCount(
this: Allocated<Self>,
sample_count: MTLSize,
) -> Retained<Self>;
#[cfg(feature = "MTLTypes")]
#[method_id(@__retain_semantics Init initWithSampleCount:horizontal:vertical:)]
pub unsafe fn initWithSampleCount_horizontal_vertical(
this: Allocated<Self>,
sample_count: MTLSize,
horizontal: NonNull<c_float>,
vertical: NonNull<c_float>,
) -> Retained<Self>;
#[cfg(feature = "MTLTypes")]
#[method(maxSampleCount)]
pub unsafe fn maxSampleCount(&self) -> MTLSize;
#[method(horizontalSampleStorage)]
pub unsafe fn horizontalSampleStorage(&self) -> NonNull<c_float>;
#[method(verticalSampleStorage)]
pub unsafe fn verticalSampleStorage(&self) -> NonNull<c_float>;
#[method_id(@__retain_semantics Other horizontal)]
pub unsafe fn horizontal(&self) -> Retained<MTLRasterizationRateSampleArray>;
#[method_id(@__retain_semantics Other vertical)]
pub unsafe fn vertical(&self) -> Retained<MTLRasterizationRateSampleArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRasterizationRateLayerDescriptor {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
unsafe impl MTLRasterizationRateLayerDescriptor {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRasterizationRateLayerArray;
unsafe impl ClassType for MTLRasterizationRateLayerArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLRasterizationRateLayerArray {}
extern_methods!(
unsafe impl MTLRasterizationRateLayerArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
layer_index: NSUInteger,
) -> Option<Retained<MTLRasterizationRateLayerDescriptor>>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
layer: Option<&MTLRasterizationRateLayerDescriptor>,
layer_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRasterizationRateLayerArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRasterizationRateMapDescriptor;
unsafe impl ClassType for MTLRasterizationRateMapDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRasterizationRateMapDescriptor {}
unsafe impl NSObjectProtocol for MTLRasterizationRateMapDescriptor {}
extern_methods!(
unsafe impl MTLRasterizationRateMapDescriptor {
#[cfg(feature = "MTLTypes")]
#[method_id(@__retain_semantics Other rasterizationRateMapDescriptorWithScreenSize:)]
pub unsafe fn rasterizationRateMapDescriptorWithScreenSize(
screen_size: MTLSize,
) -> Retained<MTLRasterizationRateMapDescriptor>;
#[cfg(feature = "MTLTypes")]
#[method_id(@__retain_semantics Other rasterizationRateMapDescriptorWithScreenSize:layer:)]
pub unsafe fn rasterizationRateMapDescriptorWithScreenSize_layer(
screen_size: MTLSize,
layer: &MTLRasterizationRateLayerDescriptor,
) -> Retained<MTLRasterizationRateMapDescriptor>;
#[cfg(feature = "MTLTypes")]
#[method_id(@__retain_semantics Other rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:)]
pub unsafe fn rasterizationRateMapDescriptorWithScreenSize_layerCount_layers(
screen_size: MTLSize,
layer_count: NSUInteger,
layers: &mut Retained<MTLRasterizationRateLayerDescriptor>,
) -> Retained<MTLRasterizationRateMapDescriptor>;
#[method_id(@__retain_semantics Other layerAtIndex:)]
pub unsafe fn layerAtIndex(
&self,
layer_index: NSUInteger,
) -> Option<Retained<MTLRasterizationRateLayerDescriptor>>;
#[method(setLayer:atIndex:)]
pub unsafe fn setLayer_atIndex(
&self,
layer: Option<&MTLRasterizationRateLayerDescriptor>,
layer_index: NSUInteger,
);
#[method_id(@__retain_semantics Other layers)]
pub unsafe fn layers(&self) -> Retained<MTLRasterizationRateLayerArray>;
#[cfg(feature = "MTLTypes")]
#[method(screenSize)]
pub unsafe fn screenSize(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
#[method(setScreenSize:)]
pub unsafe fn setScreenSize(&self, screen_size: MTLSize);
#[method_id(@__retain_semantics Other label)]
pub unsafe fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
pub unsafe fn setLabel(&self, label: Option<&NSString>);
#[method(layerCount)]
pub unsafe fn layerCount(&self) -> NSUInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRasterizationRateMapDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLRasterizationRateMap: NSObjectProtocol + IsRetainable {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
unsafe fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLTypes")]
#[method(screenSize)]
unsafe fn screenSize(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
#[method(physicalGranularity)]
unsafe fn physicalGranularity(&self) -> MTLSize;
#[method(layerCount)]
unsafe fn layerCount(&self) -> NSUInteger;
#[cfg(feature = "MTLDevice")]
#[method(parameterBufferSizeAndAlign)]
unsafe fn parameterBufferSizeAndAlign(&self) -> MTLSizeAndAlign;
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(copyParameterDataToBuffer:offset:)]
unsafe fn copyParameterDataToBuffer_offset(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
offset: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(physicalSizeForLayer:)]
unsafe fn physicalSizeForLayer(&self, layer_index: NSUInteger) -> MTLSize;
#[cfg(feature = "MTLTypes")]
#[method(mapScreenToPhysicalCoordinates:forLayer:)]
unsafe fn mapScreenToPhysicalCoordinates_forLayer(
&self,
screen_coordinates: MTLCoordinate2D,
layer_index: NSUInteger,
) -> MTLCoordinate2D;
#[cfg(feature = "MTLTypes")]
#[method(mapPhysicalToScreenCoordinates:forLayer:)]
unsafe fn mapPhysicalToScreenCoordinates_forLayer(
&self,
physical_coordinates: MTLCoordinate2D,
layer_index: NSUInteger,
) -> MTLCoordinate2D;
}
unsafe impl ProtocolType for dyn MTLRasterizationRateMap {}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,664 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLClearColor {
pub red: c_double,
pub green: c_double,
pub blue: c_double,
pub alpha: c_double,
}
unsafe impl Encode for MTLClearColor {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<c_double>::ENCODING,
<c_double>::ENCODING,
<c_double>::ENCODING,
<c_double>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLClearColor {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLClearColorMake(red: c_double,green: c_double,blue: c_double,alpha: c_double,) -> MTLClearColor;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLLoadAction(pub NSUInteger);
impl MTLLoadAction {
#[doc(alias = "MTLLoadActionDontCare")]
pub const DontCare: Self = Self(0);
#[doc(alias = "MTLLoadActionLoad")]
pub const Load: Self = Self(1);
#[doc(alias = "MTLLoadActionClear")]
pub const Clear: Self = Self(2);
}
unsafe impl Encode for MTLLoadAction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLLoadAction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLStoreAction(pub NSUInteger);
impl MTLStoreAction {
#[doc(alias = "MTLStoreActionDontCare")]
pub const DontCare: Self = Self(0);
#[doc(alias = "MTLStoreActionStore")]
pub const Store: Self = Self(1);
#[doc(alias = "MTLStoreActionMultisampleResolve")]
pub const MultisampleResolve: Self = Self(2);
#[doc(alias = "MTLStoreActionStoreAndMultisampleResolve")]
pub const StoreAndMultisampleResolve: Self = Self(3);
#[doc(alias = "MTLStoreActionUnknown")]
pub const Unknown: Self = Self(4);
#[doc(alias = "MTLStoreActionCustomSampleDepthStore")]
pub const CustomSampleDepthStore: Self = Self(5);
}
unsafe impl Encode for MTLStoreAction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLStoreAction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLStoreActionOptions(pub NSUInteger);
bitflags::bitflags! {
impl MTLStoreActionOptions: NSUInteger {
const MTLStoreActionOptionNone = 0;
const MTLStoreActionOptionCustomSamplePositions = 1<<0;
}
}
unsafe impl Encode for MTLStoreActionOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLStoreActionOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassAttachmentDescriptor;
unsafe impl ClassType for MTLRenderPassAttachmentDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRenderPassAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLRenderPassAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLRenderPassAttachmentDescriptor {
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method_id(@__retain_semantics Other texture)]
pub fn texture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(setTexture:)]
pub fn setTexture(&self, texture: Option<&ProtocolObject<dyn MTLTexture>>);
#[method(level)]
pub fn level(&self) -> NSUInteger;
#[method(setLevel:)]
pub fn setLevel(&self, level: NSUInteger);
#[method(slice)]
pub fn slice(&self) -> NSUInteger;
#[method(setSlice:)]
pub fn setSlice(&self, slice: NSUInteger);
#[method(depthPlane)]
pub fn depthPlane(&self) -> NSUInteger;
#[method(setDepthPlane:)]
pub fn setDepthPlane(&self, depth_plane: NSUInteger);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method_id(@__retain_semantics Other resolveTexture)]
pub fn resolveTexture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
#[method(setResolveTexture:)]
pub fn setResolveTexture(&self, resolve_texture: Option<&ProtocolObject<dyn MTLTexture>>);
#[method(resolveLevel)]
pub fn resolveLevel(&self) -> NSUInteger;
#[method(setResolveLevel:)]
pub fn setResolveLevel(&self, resolve_level: NSUInteger);
#[method(resolveSlice)]
pub fn resolveSlice(&self) -> NSUInteger;
#[method(setResolveSlice:)]
pub fn setResolveSlice(&self, resolve_slice: NSUInteger);
#[method(resolveDepthPlane)]
pub fn resolveDepthPlane(&self) -> NSUInteger;
#[method(setResolveDepthPlane:)]
pub fn setResolveDepthPlane(&self, resolve_depth_plane: NSUInteger);
#[method(loadAction)]
pub fn loadAction(&self) -> MTLLoadAction;
#[method(setLoadAction:)]
pub fn setLoadAction(&self, load_action: MTLLoadAction);
#[method(storeAction)]
pub fn storeAction(&self) -> MTLStoreAction;
#[method(setStoreAction:)]
pub fn setStoreAction(&self, store_action: MTLStoreAction);
#[method(storeActionOptions)]
pub fn storeActionOptions(&self) -> MTLStoreActionOptions;
#[method(setStoreActionOptions:)]
pub fn setStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassColorAttachmentDescriptor;
unsafe impl ClassType for MTLRenderPassColorAttachmentDescriptor {
#[inherits(NSObject)]
type Super = MTLRenderPassAttachmentDescriptor;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRenderPassColorAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLRenderPassColorAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLRenderPassColorAttachmentDescriptor {
#[method(clearColor)]
pub fn clearColor(&self) -> MTLClearColor;
#[method(setClearColor:)]
pub fn setClearColor(&self, clear_color: MTLClearColor);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassColorAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLRenderPassColorAttachmentDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLMultisampleDepthResolveFilter(pub NSUInteger);
impl MTLMultisampleDepthResolveFilter {
#[doc(alias = "MTLMultisampleDepthResolveFilterSample0")]
pub const Sample0: Self = Self(0);
#[doc(alias = "MTLMultisampleDepthResolveFilterMin")]
pub const Min: Self = Self(1);
#[doc(alias = "MTLMultisampleDepthResolveFilterMax")]
pub const Max: Self = Self(2);
}
unsafe impl Encode for MTLMultisampleDepthResolveFilter {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLMultisampleDepthResolveFilter {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassDepthAttachmentDescriptor;
unsafe impl ClassType for MTLRenderPassDepthAttachmentDescriptor {
#[inherits(NSObject)]
type Super = MTLRenderPassAttachmentDescriptor;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRenderPassDepthAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLRenderPassDepthAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLRenderPassDepthAttachmentDescriptor {
#[method(clearDepth)]
pub fn clearDepth(&self) -> c_double;
#[method(setClearDepth:)]
pub fn setClearDepth(&self, clear_depth: c_double);
#[method(depthResolveFilter)]
pub fn depthResolveFilter(&self) -> MTLMultisampleDepthResolveFilter;
#[method(setDepthResolveFilter:)]
pub fn setDepthResolveFilter(&self, depth_resolve_filter: MTLMultisampleDepthResolveFilter);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassDepthAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLMultisampleStencilResolveFilter(pub NSUInteger);
impl MTLMultisampleStencilResolveFilter {
#[doc(alias = "MTLMultisampleStencilResolveFilterSample0")]
pub const Sample0: Self = Self(0);
#[doc(alias = "MTLMultisampleStencilResolveFilterDepthResolvedSample")]
pub const DepthResolvedSample: Self = Self(1);
}
unsafe impl Encode for MTLMultisampleStencilResolveFilter {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLMultisampleStencilResolveFilter {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassStencilAttachmentDescriptor;
unsafe impl ClassType for MTLRenderPassStencilAttachmentDescriptor {
#[inherits(NSObject)]
type Super = MTLRenderPassAttachmentDescriptor;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRenderPassStencilAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLRenderPassStencilAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLRenderPassStencilAttachmentDescriptor {
#[method(clearStencil)]
pub fn clearStencil(&self) -> u32;
#[method(setClearStencil:)]
pub fn setClearStencil(&self, clear_stencil: u32);
#[method(stencilResolveFilter)]
pub fn stencilResolveFilter(&self) -> MTLMultisampleStencilResolveFilter;
#[method(setStencilResolveFilter:)]
pub fn setStencilResolveFilter(
&self,
stencil_resolve_filter: MTLMultisampleStencilResolveFilter,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassStencilAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassColorAttachmentDescriptorArray;
unsafe impl ClassType for MTLRenderPassColorAttachmentDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLRenderPassColorAttachmentDescriptorArray {}
extern_methods!(
unsafe impl MTLRenderPassColorAttachmentDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLRenderPassColorAttachmentDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLRenderPassColorAttachmentDescriptor>,
attachment_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassColorAttachmentDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassSampleBufferAttachmentDescriptor;
unsafe impl ClassType for MTLRenderPassSampleBufferAttachmentDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRenderPassSampleBufferAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLRenderPassSampleBufferAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLRenderPassSampleBufferAttachmentDescriptor {
#[cfg(feature = "MTLCounters")]
#[method_id(@__retain_semantics Other sampleBuffer)]
pub fn sampleBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
#[cfg(feature = "MTLCounters")]
#[method(setSampleBuffer:)]
pub fn setSampleBuffer(
&self,
sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
);
#[method(startOfVertexSampleIndex)]
pub fn startOfVertexSampleIndex(&self) -> NSUInteger;
#[method(setStartOfVertexSampleIndex:)]
pub unsafe fn setStartOfVertexSampleIndex(&self, start_of_vertex_sample_index: NSUInteger);
#[method(endOfVertexSampleIndex)]
pub fn endOfVertexSampleIndex(&self) -> NSUInteger;
#[method(setEndOfVertexSampleIndex:)]
pub unsafe fn setEndOfVertexSampleIndex(&self, end_of_vertex_sample_index: NSUInteger);
#[method(startOfFragmentSampleIndex)]
pub fn startOfFragmentSampleIndex(&self) -> NSUInteger;
#[method(setStartOfFragmentSampleIndex:)]
pub unsafe fn setStartOfFragmentSampleIndex(
&self,
start_of_fragment_sample_index: NSUInteger,
);
#[method(endOfFragmentSampleIndex)]
pub fn endOfFragmentSampleIndex(&self) -> NSUInteger;
#[method(setEndOfFragmentSampleIndex:)]
pub unsafe fn setEndOfFragmentSampleIndex(&self, end_of_fragment_sample_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassSampleBufferAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassSampleBufferAttachmentDescriptorArray;
unsafe impl ClassType for MTLRenderPassSampleBufferAttachmentDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLRenderPassSampleBufferAttachmentDescriptorArray {}
extern_methods!(
unsafe impl MTLRenderPassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLRenderPassSampleBufferAttachmentDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLRenderPassSampleBufferAttachmentDescriptor>,
attachment_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassDescriptor;
unsafe impl ClassType for MTLRenderPassDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLRenderPassDescriptor {}
unsafe impl NSObjectProtocol for MTLRenderPassDescriptor {}
extern_methods!(
unsafe impl MTLRenderPassDescriptor {
#[method_id(@__retain_semantics Other renderPassDescriptor)]
pub fn renderPassDescriptor() -> Retained<MTLRenderPassDescriptor>;
#[method_id(@__retain_semantics Other colorAttachments)]
pub fn colorAttachments(&self) -> Retained<MTLRenderPassColorAttachmentDescriptorArray>;
#[method_id(@__retain_semantics Other depthAttachment)]
pub fn depthAttachment(&self) -> Retained<MTLRenderPassDepthAttachmentDescriptor>;
#[method(setDepthAttachment:)]
pub fn setDepthAttachment(
&self,
depth_attachment: Option<&MTLRenderPassDepthAttachmentDescriptor>,
);
#[method_id(@__retain_semantics Other stencilAttachment)]
pub fn stencilAttachment(&self) -> Retained<MTLRenderPassStencilAttachmentDescriptor>;
#[method(setStencilAttachment:)]
pub fn setStencilAttachment(
&self,
stencil_attachment: Option<&MTLRenderPassStencilAttachmentDescriptor>,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method_id(@__retain_semantics Other visibilityResultBuffer)]
pub fn visibilityResultBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
#[method(setVisibilityResultBuffer:)]
pub fn setVisibilityResultBuffer(
&self,
visibility_result_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
);
#[method(renderTargetArrayLength)]
pub fn renderTargetArrayLength(&self) -> NSUInteger;
#[method(setRenderTargetArrayLength:)]
pub unsafe fn setRenderTargetArrayLength(&self, render_target_array_length: NSUInteger);
#[method(imageblockSampleLength)]
pub fn imageblockSampleLength(&self) -> NSUInteger;
#[method(setImageblockSampleLength:)]
pub unsafe fn setImageblockSampleLength(&self, imageblock_sample_length: NSUInteger);
#[method(threadgroupMemoryLength)]
pub fn threadgroupMemoryLength(&self) -> NSUInteger;
#[method(setThreadgroupMemoryLength:)]
pub unsafe fn setThreadgroupMemoryLength(&self, threadgroup_memory_length: NSUInteger);
#[method(tileWidth)]
pub fn tileWidth(&self) -> NSUInteger;
#[method(setTileWidth:)]
pub fn setTileWidth(&self, tile_width: NSUInteger);
#[method(tileHeight)]
pub fn tileHeight(&self) -> NSUInteger;
#[method(setTileHeight:)]
pub fn setTileHeight(&self, tile_height: NSUInteger);
#[method(defaultRasterSampleCount)]
pub fn defaultRasterSampleCount(&self) -> NSUInteger;
#[method(setDefaultRasterSampleCount:)]
pub fn setDefaultRasterSampleCount(&self, default_raster_sample_count: NSUInteger);
#[method(renderTargetWidth)]
pub fn renderTargetWidth(&self) -> NSUInteger;
#[method(setRenderTargetWidth:)]
pub fn setRenderTargetWidth(&self, render_target_width: NSUInteger);
#[method(renderTargetHeight)]
pub fn renderTargetHeight(&self) -> NSUInteger;
#[method(setRenderTargetHeight:)]
pub fn setRenderTargetHeight(&self, render_target_height: NSUInteger);
#[cfg(feature = "MTLTypes")]
#[method(setSamplePositions:count:)]
pub unsafe fn setSamplePositions_count(
&self,
positions: *mut MTLSamplePosition,
count: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(getSamplePositions:count:)]
pub unsafe fn getSamplePositions_count(
&self,
positions: *mut MTLSamplePosition,
count: NSUInteger,
) -> NSUInteger;
#[cfg(feature = "MTLRasterizationRate")]
#[method_id(@__retain_semantics Other rasterizationRateMap)]
pub fn rasterizationRateMap(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLRasterizationRateMap>>>;
#[cfg(feature = "MTLRasterizationRate")]
#[method(setRasterizationRateMap:)]
pub fn setRasterizationRateMap(
&self,
rasterization_rate_map: Option<&ProtocolObject<dyn MTLRasterizationRateMap>>,
);
#[method_id(@__retain_semantics Other sampleBufferAttachments)]
pub fn sampleBufferAttachments(
&self,
) -> Retained<MTLRenderPassSampleBufferAttachmentDescriptorArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLRenderPassDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
// TODO: pub fn MTLClearColorMake(red: c_double,green: c_double,blue: c_double,alpha: c_double,) -> MTLClearColor;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,169 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLPurgeableState(pub NSUInteger);
impl MTLPurgeableState {
#[doc(alias = "MTLPurgeableStateKeepCurrent")]
pub const KeepCurrent: Self = Self(1);
#[doc(alias = "MTLPurgeableStateNonVolatile")]
pub const NonVolatile: Self = Self(2);
#[doc(alias = "MTLPurgeableStateVolatile")]
pub const Volatile: Self = Self(3);
#[doc(alias = "MTLPurgeableStateEmpty")]
pub const Empty: Self = Self(4);
}
unsafe impl Encode for MTLPurgeableState {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLPurgeableState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCPUCacheMode(pub NSUInteger);
impl MTLCPUCacheMode {
#[doc(alias = "MTLCPUCacheModeDefaultCache")]
pub const DefaultCache: Self = Self(0);
#[doc(alias = "MTLCPUCacheModeWriteCombined")]
pub const WriteCombined: Self = Self(1);
}
unsafe impl Encode for MTLCPUCacheMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLCPUCacheMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLStorageMode(pub NSUInteger);
impl MTLStorageMode {
#[doc(alias = "MTLStorageModeShared")]
pub const Shared: Self = Self(0);
#[doc(alias = "MTLStorageModeManaged")]
pub const Managed: Self = Self(1);
#[doc(alias = "MTLStorageModePrivate")]
pub const Private: Self = Self(2);
#[doc(alias = "MTLStorageModeMemoryless")]
pub const Memoryless: Self = Self(3);
}
unsafe impl Encode for MTLStorageMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLStorageMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLHazardTrackingMode(pub NSUInteger);
impl MTLHazardTrackingMode {
#[doc(alias = "MTLHazardTrackingModeDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "MTLHazardTrackingModeUntracked")]
pub const Untracked: Self = Self(1);
#[doc(alias = "MTLHazardTrackingModeTracked")]
pub const Tracked: Self = Self(2);
}
unsafe impl Encode for MTLHazardTrackingMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLHazardTrackingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLResourceOptions(pub NSUInteger);
bitflags::bitflags! {
impl MTLResourceOptions: NSUInteger {
const MTLResourceCPUCacheModeDefaultCache = MTLCPUCacheMode::DefaultCache.0<<MTLResourceCPUCacheModeShift;
const MTLResourceCPUCacheModeWriteCombined = MTLCPUCacheMode::WriteCombined.0<<MTLResourceCPUCacheModeShift;
const MTLResourceStorageModeShared = MTLStorageMode::Shared.0<<MTLResourceStorageModeShift;
const MTLResourceStorageModeManaged = MTLStorageMode::Managed.0<<MTLResourceStorageModeShift;
const MTLResourceStorageModePrivate = MTLStorageMode::Private.0<<MTLResourceStorageModeShift;
const MTLResourceStorageModeMemoryless = MTLStorageMode::Memoryless.0<<MTLResourceStorageModeShift;
const MTLResourceHazardTrackingModeDefault = MTLHazardTrackingMode::Default.0<<MTLResourceHazardTrackingModeShift;
const MTLResourceHazardTrackingModeUntracked = MTLHazardTrackingMode::Untracked.0<<MTLResourceHazardTrackingModeShift;
const MTLResourceHazardTrackingModeTracked = MTLHazardTrackingMode::Tracked.0<<MTLResourceHazardTrackingModeShift;
#[deprecated]
const MTLResourceOptionCPUCacheModeDefault = MTLResourceOptions::MTLResourceCPUCacheModeDefaultCache.0;
#[deprecated]
const MTLResourceOptionCPUCacheModeWriteCombined = MTLResourceOptions::MTLResourceCPUCacheModeWriteCombined.0;
}
}
unsafe impl Encode for MTLResourceOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLResourceOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait MTLResource: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method(cpuCacheMode)]
fn cpuCacheMode(&self) -> MTLCPUCacheMode;
#[method(storageMode)]
fn storageMode(&self) -> MTLStorageMode;
#[method(hazardTrackingMode)]
fn hazardTrackingMode(&self) -> MTLHazardTrackingMode;
#[method(resourceOptions)]
fn resourceOptions(&self) -> MTLResourceOptions;
#[method(setPurgeableState:)]
fn setPurgeableState(&self, state: MTLPurgeableState) -> MTLPurgeableState;
#[cfg(feature = "MTLHeap")]
#[method_id(@__retain_semantics Other heap)]
fn heap(&self) -> Option<Retained<ProtocolObject<dyn MTLHeap>>>;
#[method(heapOffset)]
fn heapOffset(&self) -> NSUInteger;
#[method(allocatedSize)]
fn allocatedSize(&self) -> NSUInteger;
#[method(makeAliasable)]
unsafe fn makeAliasable(&self);
#[method(isAliasable)]
fn isAliasable(&self) -> bool;
}
unsafe impl ProtocolType for dyn MTLResource {}
);

View File

@@ -0,0 +1,129 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLSparseTextureMappingMode(pub NSUInteger);
impl MTLSparseTextureMappingMode {
#[doc(alias = "MTLSparseTextureMappingModeMap")]
pub const Map: Self = Self(0);
#[doc(alias = "MTLSparseTextureMappingModeUnmap")]
pub const Unmap: Self = Self(1);
}
unsafe impl Encode for MTLSparseTextureMappingMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLSparseTextureMappingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLMapIndirectArguments {
pub regionOriginX: u32,
pub regionOriginY: u32,
pub regionOriginZ: u32,
pub regionSizeWidth: u32,
pub regionSizeHeight: u32,
pub regionSizeDepth: u32,
pub mipMapLevel: u32,
pub sliceId: u32,
}
unsafe impl Encode for MTLMapIndirectArguments {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<u32>::ENCODING,
<u32>::ENCODING,
<u32>::ENCODING,
<u32>::ENCODING,
<u32>::ENCODING,
<u32>::ENCODING,
<u32>::ENCODING,
<u32>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLMapIndirectArguments {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
#[cfg(feature = "MTLCommandEncoder")]
pub unsafe trait MTLResourceStateCommandEncoder:
MTLCommandEncoder + IsRetainable
{
#[cfg(all(feature = "MTLResource", feature = "MTLTexture", feature = "MTLTypes"))]
#[optional]
#[method(updateTextureMappings:mode:regions:mipLevels:slices:numRegions:)]
unsafe fn updateTextureMappings_mode_regions_mipLevels_slices_numRegions(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
mode: MTLSparseTextureMappingMode,
regions: NonNull<MTLRegion>,
mip_levels: NonNull<NSUInteger>,
slices: NonNull<NSUInteger>,
num_regions: NSUInteger,
);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture", feature = "MTLTypes"))]
#[optional]
#[method(updateTextureMapping:mode:region:mipLevel:slice:)]
unsafe fn updateTextureMapping_mode_region_mipLevel_slice(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
mode: MTLSparseTextureMappingMode,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
);
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource", feature = "MTLTexture"))]
#[optional]
#[method(updateTextureMapping:mode:indirectBuffer:indirectBufferOffset:)]
unsafe fn updateTextureMapping_mode_indirectBuffer_indirectBufferOffset(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
mode: MTLSparseTextureMappingMode,
indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
indirect_buffer_offset: NSUInteger,
);
#[cfg(feature = "MTLFence")]
#[optional]
#[method(updateFence:)]
unsafe fn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(feature = "MTLFence")]
#[optional]
#[method(waitForFence:)]
unsafe fn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>);
#[cfg(all(feature = "MTLResource", feature = "MTLTexture", feature = "MTLTypes"))]
#[optional]
#[method(moveTextureMappingsFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:)]
unsafe fn moveTextureMappingsFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
);
}
#[cfg(feature = "MTLCommandEncoder")]
unsafe impl ProtocolType for dyn MTLResourceStateCommandEncoder {}
);

View File

@@ -0,0 +1,140 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLResourceStatePassSampleBufferAttachmentDescriptor;
unsafe impl ClassType for MTLResourceStatePassSampleBufferAttachmentDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLResourceStatePassSampleBufferAttachmentDescriptor {}
unsafe impl NSObjectProtocol for MTLResourceStatePassSampleBufferAttachmentDescriptor {}
extern_methods!(
unsafe impl MTLResourceStatePassSampleBufferAttachmentDescriptor {
#[cfg(feature = "MTLCounters")]
#[method_id(@__retain_semantics Other sampleBuffer)]
pub unsafe fn sampleBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
#[cfg(feature = "MTLCounters")]
#[method(setSampleBuffer:)]
pub unsafe fn setSampleBuffer(
&self,
sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
);
#[method(startOfEncoderSampleIndex)]
pub unsafe fn startOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setStartOfEncoderSampleIndex:)]
pub unsafe fn setStartOfEncoderSampleIndex(
&self,
start_of_encoder_sample_index: NSUInteger,
);
#[method(endOfEncoderSampleIndex)]
pub unsafe fn endOfEncoderSampleIndex(&self) -> NSUInteger;
#[method(setEndOfEncoderSampleIndex:)]
pub unsafe fn setEndOfEncoderSampleIndex(&self, end_of_encoder_sample_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLResourceStatePassSampleBufferAttachmentDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLResourceStatePassSampleBufferAttachmentDescriptorArray;
unsafe impl ClassType for MTLResourceStatePassSampleBufferAttachmentDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLResourceStatePassSampleBufferAttachmentDescriptorArray {}
extern_methods!(
unsafe impl MTLResourceStatePassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLResourceStatePassSampleBufferAttachmentDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLResourceStatePassSampleBufferAttachmentDescriptor>,
attachment_index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLResourceStatePassSampleBufferAttachmentDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLResourceStatePassDescriptor;
unsafe impl ClassType for MTLResourceStatePassDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLResourceStatePassDescriptor {}
unsafe impl NSObjectProtocol for MTLResourceStatePassDescriptor {}
extern_methods!(
unsafe impl MTLResourceStatePassDescriptor {
#[method_id(@__retain_semantics Other resourceStatePassDescriptor)]
pub unsafe fn resourceStatePassDescriptor() -> Retained<MTLResourceStatePassDescriptor>;
#[method_id(@__retain_semantics Other sampleBufferAttachments)]
pub unsafe fn sampleBufferAttachments(
&self,
) -> Retained<MTLResourceStatePassSampleBufferAttachmentDescriptorArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLResourceStatePassDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,239 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLSamplerMinMagFilter(pub NSUInteger);
impl MTLSamplerMinMagFilter {
#[doc(alias = "MTLSamplerMinMagFilterNearest")]
pub const Nearest: Self = Self(0);
#[doc(alias = "MTLSamplerMinMagFilterLinear")]
pub const Linear: Self = Self(1);
}
unsafe impl Encode for MTLSamplerMinMagFilter {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLSamplerMinMagFilter {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLSamplerMipFilter(pub NSUInteger);
impl MTLSamplerMipFilter {
#[doc(alias = "MTLSamplerMipFilterNotMipmapped")]
pub const NotMipmapped: Self = Self(0);
#[doc(alias = "MTLSamplerMipFilterNearest")]
pub const Nearest: Self = Self(1);
#[doc(alias = "MTLSamplerMipFilterLinear")]
pub const Linear: Self = Self(2);
}
unsafe impl Encode for MTLSamplerMipFilter {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLSamplerMipFilter {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLSamplerAddressMode(pub NSUInteger);
impl MTLSamplerAddressMode {
#[doc(alias = "MTLSamplerAddressModeClampToEdge")]
pub const ClampToEdge: Self = Self(0);
#[doc(alias = "MTLSamplerAddressModeMirrorClampToEdge")]
pub const MirrorClampToEdge: Self = Self(1);
#[doc(alias = "MTLSamplerAddressModeRepeat")]
pub const Repeat: Self = Self(2);
#[doc(alias = "MTLSamplerAddressModeMirrorRepeat")]
pub const MirrorRepeat: Self = Self(3);
#[doc(alias = "MTLSamplerAddressModeClampToZero")]
pub const ClampToZero: Self = Self(4);
#[doc(alias = "MTLSamplerAddressModeClampToBorderColor")]
pub const ClampToBorderColor: Self = Self(5);
}
unsafe impl Encode for MTLSamplerAddressMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLSamplerAddressMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLSamplerBorderColor(pub NSUInteger);
impl MTLSamplerBorderColor {
#[doc(alias = "MTLSamplerBorderColorTransparentBlack")]
pub const TransparentBlack: Self = Self(0);
#[doc(alias = "MTLSamplerBorderColorOpaqueBlack")]
pub const OpaqueBlack: Self = Self(1);
#[doc(alias = "MTLSamplerBorderColorOpaqueWhite")]
pub const OpaqueWhite: Self = Self(2);
}
unsafe impl Encode for MTLSamplerBorderColor {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLSamplerBorderColor {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLSamplerDescriptor;
unsafe impl ClassType for MTLSamplerDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLSamplerDescriptor {}
unsafe impl NSObjectProtocol for MTLSamplerDescriptor {}
extern_methods!(
unsafe impl MTLSamplerDescriptor {
#[method(minFilter)]
pub fn minFilter(&self) -> MTLSamplerMinMagFilter;
#[method(setMinFilter:)]
pub fn setMinFilter(&self, min_filter: MTLSamplerMinMagFilter);
#[method(magFilter)]
pub fn magFilter(&self) -> MTLSamplerMinMagFilter;
#[method(setMagFilter:)]
pub fn setMagFilter(&self, mag_filter: MTLSamplerMinMagFilter);
#[method(mipFilter)]
pub fn mipFilter(&self) -> MTLSamplerMipFilter;
#[method(setMipFilter:)]
pub fn setMipFilter(&self, mip_filter: MTLSamplerMipFilter);
#[method(maxAnisotropy)]
pub fn maxAnisotropy(&self) -> NSUInteger;
#[method(setMaxAnisotropy:)]
pub fn setMaxAnisotropy(&self, max_anisotropy: NSUInteger);
#[method(sAddressMode)]
pub fn sAddressMode(&self) -> MTLSamplerAddressMode;
#[method(setSAddressMode:)]
pub fn setSAddressMode(&self, s_address_mode: MTLSamplerAddressMode);
#[method(tAddressMode)]
pub fn tAddressMode(&self) -> MTLSamplerAddressMode;
#[method(setTAddressMode:)]
pub fn setTAddressMode(&self, t_address_mode: MTLSamplerAddressMode);
#[method(rAddressMode)]
pub fn rAddressMode(&self) -> MTLSamplerAddressMode;
#[method(setRAddressMode:)]
pub fn setRAddressMode(&self, r_address_mode: MTLSamplerAddressMode);
#[method(borderColor)]
pub fn borderColor(&self) -> MTLSamplerBorderColor;
#[method(setBorderColor:)]
pub fn setBorderColor(&self, border_color: MTLSamplerBorderColor);
#[method(normalizedCoordinates)]
pub fn normalizedCoordinates(&self) -> bool;
#[method(setNormalizedCoordinates:)]
pub fn setNormalizedCoordinates(&self, normalized_coordinates: bool);
#[method(lodMinClamp)]
pub fn lodMinClamp(&self) -> c_float;
#[method(setLodMinClamp:)]
pub fn setLodMinClamp(&self, lod_min_clamp: c_float);
#[method(lodMaxClamp)]
pub fn lodMaxClamp(&self) -> c_float;
#[method(setLodMaxClamp:)]
pub fn setLodMaxClamp(&self, lod_max_clamp: c_float);
#[method(lodAverage)]
pub fn lodAverage(&self) -> bool;
#[method(setLodAverage:)]
pub fn setLodAverage(&self, lod_average: bool);
#[cfg(feature = "MTLDepthStencil")]
#[method(compareFunction)]
pub fn compareFunction(&self) -> MTLCompareFunction;
#[cfg(feature = "MTLDepthStencil")]
#[method(setCompareFunction:)]
pub fn setCompareFunction(&self, compare_function: MTLCompareFunction);
#[method(supportArgumentBuffers)]
pub fn supportArgumentBuffers(&self) -> bool;
#[method(setSupportArgumentBuffers:)]
pub fn setSupportArgumentBuffers(&self, support_argument_buffers: bool);
#[method_id(@__retain_semantics Other label)]
pub fn label(&self) -> Option<Retained<NSString>>;
#[method(setLabel:)]
pub fn setLabel(&self, label: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLSamplerDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLSamplerDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait MTLSamplerState: NSObjectProtocol + IsRetainable {
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[cfg(feature = "MTLTypes")]
#[method(gpuResourceID)]
unsafe fn gpuResourceID(&self) -> MTLResourceID;
}
unsafe impl ProtocolType for dyn MTLSamplerState {}
);

View File

@@ -0,0 +1,408 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLAttributeFormat(pub NSUInteger);
impl MTLAttributeFormat {
#[doc(alias = "MTLAttributeFormatInvalid")]
pub const Invalid: Self = Self(0);
#[doc(alias = "MTLAttributeFormatUChar2")]
pub const UChar2: Self = Self(1);
#[doc(alias = "MTLAttributeFormatUChar3")]
pub const UChar3: Self = Self(2);
#[doc(alias = "MTLAttributeFormatUChar4")]
pub const UChar4: Self = Self(3);
#[doc(alias = "MTLAttributeFormatChar2")]
pub const Char2: Self = Self(4);
#[doc(alias = "MTLAttributeFormatChar3")]
pub const Char3: Self = Self(5);
#[doc(alias = "MTLAttributeFormatChar4")]
pub const Char4: Self = Self(6);
#[doc(alias = "MTLAttributeFormatUChar2Normalized")]
pub const UChar2Normalized: Self = Self(7);
#[doc(alias = "MTLAttributeFormatUChar3Normalized")]
pub const UChar3Normalized: Self = Self(8);
#[doc(alias = "MTLAttributeFormatUChar4Normalized")]
pub const UChar4Normalized: Self = Self(9);
#[doc(alias = "MTLAttributeFormatChar2Normalized")]
pub const Char2Normalized: Self = Self(10);
#[doc(alias = "MTLAttributeFormatChar3Normalized")]
pub const Char3Normalized: Self = Self(11);
#[doc(alias = "MTLAttributeFormatChar4Normalized")]
pub const Char4Normalized: Self = Self(12);
#[doc(alias = "MTLAttributeFormatUShort2")]
pub const UShort2: Self = Self(13);
#[doc(alias = "MTLAttributeFormatUShort3")]
pub const UShort3: Self = Self(14);
#[doc(alias = "MTLAttributeFormatUShort4")]
pub const UShort4: Self = Self(15);
#[doc(alias = "MTLAttributeFormatShort2")]
pub const Short2: Self = Self(16);
#[doc(alias = "MTLAttributeFormatShort3")]
pub const Short3: Self = Self(17);
#[doc(alias = "MTLAttributeFormatShort4")]
pub const Short4: Self = Self(18);
#[doc(alias = "MTLAttributeFormatUShort2Normalized")]
pub const UShort2Normalized: Self = Self(19);
#[doc(alias = "MTLAttributeFormatUShort3Normalized")]
pub const UShort3Normalized: Self = Self(20);
#[doc(alias = "MTLAttributeFormatUShort4Normalized")]
pub const UShort4Normalized: Self = Self(21);
#[doc(alias = "MTLAttributeFormatShort2Normalized")]
pub const Short2Normalized: Self = Self(22);
#[doc(alias = "MTLAttributeFormatShort3Normalized")]
pub const Short3Normalized: Self = Self(23);
#[doc(alias = "MTLAttributeFormatShort4Normalized")]
pub const Short4Normalized: Self = Self(24);
#[doc(alias = "MTLAttributeFormatHalf2")]
pub const Half2: Self = Self(25);
#[doc(alias = "MTLAttributeFormatHalf3")]
pub const Half3: Self = Self(26);
#[doc(alias = "MTLAttributeFormatHalf4")]
pub const Half4: Self = Self(27);
#[doc(alias = "MTLAttributeFormatFloat")]
pub const Float: Self = Self(28);
#[doc(alias = "MTLAttributeFormatFloat2")]
pub const Float2: Self = Self(29);
#[doc(alias = "MTLAttributeFormatFloat3")]
pub const Float3: Self = Self(30);
#[doc(alias = "MTLAttributeFormatFloat4")]
pub const Float4: Self = Self(31);
#[doc(alias = "MTLAttributeFormatInt")]
pub const Int: Self = Self(32);
#[doc(alias = "MTLAttributeFormatInt2")]
pub const Int2: Self = Self(33);
#[doc(alias = "MTLAttributeFormatInt3")]
pub const Int3: Self = Self(34);
#[doc(alias = "MTLAttributeFormatInt4")]
pub const Int4: Self = Self(35);
#[doc(alias = "MTLAttributeFormatUInt")]
pub const UInt: Self = Self(36);
#[doc(alias = "MTLAttributeFormatUInt2")]
pub const UInt2: Self = Self(37);
#[doc(alias = "MTLAttributeFormatUInt3")]
pub const UInt3: Self = Self(38);
#[doc(alias = "MTLAttributeFormatUInt4")]
pub const UInt4: Self = Self(39);
#[doc(alias = "MTLAttributeFormatInt1010102Normalized")]
pub const Int1010102Normalized: Self = Self(40);
#[doc(alias = "MTLAttributeFormatUInt1010102Normalized")]
pub const UInt1010102Normalized: Self = Self(41);
#[doc(alias = "MTLAttributeFormatUChar4Normalized_BGRA")]
pub const UChar4Normalized_BGRA: Self = Self(42);
#[doc(alias = "MTLAttributeFormatUChar")]
pub const UChar: Self = Self(45);
#[doc(alias = "MTLAttributeFormatChar")]
pub const Char: Self = Self(46);
#[doc(alias = "MTLAttributeFormatUCharNormalized")]
pub const UCharNormalized: Self = Self(47);
#[doc(alias = "MTLAttributeFormatCharNormalized")]
pub const CharNormalized: Self = Self(48);
#[doc(alias = "MTLAttributeFormatUShort")]
pub const UShort: Self = Self(49);
#[doc(alias = "MTLAttributeFormatShort")]
pub const Short: Self = Self(50);
#[doc(alias = "MTLAttributeFormatUShortNormalized")]
pub const UShortNormalized: Self = Self(51);
#[doc(alias = "MTLAttributeFormatShortNormalized")]
pub const ShortNormalized: Self = Self(52);
#[doc(alias = "MTLAttributeFormatHalf")]
pub const Half: Self = Self(53);
#[doc(alias = "MTLAttributeFormatFloatRG11B10")]
pub const FloatRG11B10: Self = Self(54);
#[doc(alias = "MTLAttributeFormatFloatRGB9E5")]
pub const FloatRGB9E5: Self = Self(55);
}
unsafe impl Encode for MTLAttributeFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLAttributeFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIndexType(pub NSUInteger);
impl MTLIndexType {
#[doc(alias = "MTLIndexTypeUInt16")]
pub const UInt16: Self = Self(0);
#[doc(alias = "MTLIndexTypeUInt32")]
pub const UInt32: Self = Self(1);
}
unsafe impl Encode for MTLIndexType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLIndexType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLStepFunction(pub NSUInteger);
impl MTLStepFunction {
#[doc(alias = "MTLStepFunctionConstant")]
pub const Constant: Self = Self(0);
#[doc(alias = "MTLStepFunctionPerVertex")]
pub const PerVertex: Self = Self(1);
#[doc(alias = "MTLStepFunctionPerInstance")]
pub const PerInstance: Self = Self(2);
#[doc(alias = "MTLStepFunctionPerPatch")]
pub const PerPatch: Self = Self(3);
#[doc(alias = "MTLStepFunctionPerPatchControlPoint")]
pub const PerPatchControlPoint: Self = Self(4);
#[doc(alias = "MTLStepFunctionThreadPositionInGridX")]
pub const ThreadPositionInGridX: Self = Self(5);
#[doc(alias = "MTLStepFunctionThreadPositionInGridY")]
pub const ThreadPositionInGridY: Self = Self(6);
#[doc(alias = "MTLStepFunctionThreadPositionInGridXIndexed")]
pub const ThreadPositionInGridXIndexed: Self = Self(7);
#[doc(alias = "MTLStepFunctionThreadPositionInGridYIndexed")]
pub const ThreadPositionInGridYIndexed: Self = Self(8);
}
unsafe impl Encode for MTLStepFunction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLStepFunction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLBufferLayoutDescriptor;
unsafe impl ClassType for MTLBufferLayoutDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLBufferLayoutDescriptor {}
unsafe impl NSObjectProtocol for MTLBufferLayoutDescriptor {}
extern_methods!(
unsafe impl MTLBufferLayoutDescriptor {
#[method(stride)]
pub fn stride(&self) -> NSUInteger;
#[method(setStride:)]
pub fn setStride(&self, stride: NSUInteger);
#[method(stepFunction)]
pub fn stepFunction(&self) -> MTLStepFunction;
#[method(setStepFunction:)]
pub fn setStepFunction(&self, step_function: MTLStepFunction);
#[method(stepRate)]
pub fn stepRate(&self) -> NSUInteger;
#[method(setStepRate:)]
pub fn setStepRate(&self, step_rate: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLBufferLayoutDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLBufferLayoutDescriptorArray;
unsafe impl ClassType for MTLBufferLayoutDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLBufferLayoutDescriptorArray {}
extern_methods!(
unsafe impl MTLBufferLayoutDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
index: NSUInteger,
) -> Retained<MTLBufferLayoutDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
buffer_desc: Option<&MTLBufferLayoutDescriptor>,
index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLBufferLayoutDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAttributeDescriptor;
unsafe impl ClassType for MTLAttributeDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLAttributeDescriptor {}
unsafe impl NSObjectProtocol for MTLAttributeDescriptor {}
extern_methods!(
unsafe impl MTLAttributeDescriptor {
#[method(format)]
pub fn format(&self) -> MTLAttributeFormat;
#[method(setFormat:)]
pub fn setFormat(&self, format: MTLAttributeFormat);
#[method(offset)]
pub fn offset(&self) -> NSUInteger;
#[method(setOffset:)]
pub fn setOffset(&self, offset: NSUInteger);
#[method(bufferIndex)]
pub fn bufferIndex(&self) -> NSUInteger;
#[method(setBufferIndex:)]
pub unsafe fn setBufferIndex(&self, buffer_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLAttributeDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLAttributeDescriptorArray;
unsafe impl ClassType for MTLAttributeDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLAttributeDescriptorArray {}
extern_methods!(
unsafe impl MTLAttributeDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
index: NSUInteger,
) -> Retained<MTLAttributeDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attribute_desc: Option<&MTLAttributeDescriptor>,
index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLAttributeDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLStageInputOutputDescriptor;
unsafe impl ClassType for MTLStageInputOutputDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLStageInputOutputDescriptor {}
unsafe impl NSObjectProtocol for MTLStageInputOutputDescriptor {}
extern_methods!(
unsafe impl MTLStageInputOutputDescriptor {
#[method_id(@__retain_semantics Other stageInputOutputDescriptor)]
pub fn stageInputOutputDescriptor() -> Retained<MTLStageInputOutputDescriptor>;
#[method_id(@__retain_semantics Other layouts)]
pub fn layouts(&self) -> Retained<MTLBufferLayoutDescriptorArray>;
#[method_id(@__retain_semantics Other attributes)]
pub fn attributes(&self) -> Retained<MTLAttributeDescriptorArray>;
#[method(indexType)]
pub fn indexType(&self) -> MTLIndexType;
#[method(setIndexType:)]
pub unsafe fn setIndexType(&self, index_type: MTLIndexType);
#[method(indexBufferIndex)]
pub fn indexBufferIndex(&self) -> NSUInteger;
#[method(setIndexBufferIndex:)]
pub unsafe fn setIndexBufferIndex(&self, index_buffer_index: NSUInteger);
#[method(reset)]
pub fn reset(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLStageInputOutputDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,513 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTextureType(pub NSUInteger);
impl MTLTextureType {
pub const MTLTextureType1D: Self = Self(0);
pub const MTLTextureType1DArray: Self = Self(1);
pub const MTLTextureType2D: Self = Self(2);
pub const MTLTextureType2DArray: Self = Self(3);
pub const MTLTextureType2DMultisample: Self = Self(4);
#[doc(alias = "MTLTextureTypeCube")]
pub const Cube: Self = Self(5);
#[doc(alias = "MTLTextureTypeCubeArray")]
pub const CubeArray: Self = Self(6);
pub const MTLTextureType3D: Self = Self(7);
pub const MTLTextureType2DMultisampleArray: Self = Self(8);
#[doc(alias = "MTLTextureTypeTextureBuffer")]
pub const TextureBuffer: Self = Self(9);
}
unsafe impl Encode for MTLTextureType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLTextureType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTextureSwizzle(pub u8);
impl MTLTextureSwizzle {
#[doc(alias = "MTLTextureSwizzleZero")]
pub const Zero: Self = Self(0);
#[doc(alias = "MTLTextureSwizzleOne")]
pub const One: Self = Self(1);
#[doc(alias = "MTLTextureSwizzleRed")]
pub const Red: Self = Self(2);
#[doc(alias = "MTLTextureSwizzleGreen")]
pub const Green: Self = Self(3);
#[doc(alias = "MTLTextureSwizzleBlue")]
pub const Blue: Self = Self(4);
#[doc(alias = "MTLTextureSwizzleAlpha")]
pub const Alpha: Self = Self(5);
}
unsafe impl Encode for MTLTextureSwizzle {
const ENCODING: Encoding = u8::ENCODING;
}
unsafe impl RefEncode for MTLTextureSwizzle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLTextureSwizzleChannels {
pub red: MTLTextureSwizzle,
pub green: MTLTextureSwizzle,
pub blue: MTLTextureSwizzle,
pub alpha: MTLTextureSwizzle,
}
unsafe impl Encode for MTLTextureSwizzleChannels {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<MTLTextureSwizzle>::ENCODING,
<MTLTextureSwizzle>::ENCODING,
<MTLTextureSwizzle>::ENCODING,
<MTLTextureSwizzle>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLTextureSwizzleChannels {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLTextureSwizzleChannelsMake(r: MTLTextureSwizzle,g: MTLTextureSwizzle,b: MTLTextureSwizzle,a: MTLTextureSwizzle,) -> MTLTextureSwizzleChannels;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLSharedTextureHandle;
unsafe impl ClassType for MTLSharedTextureHandle {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for MTLSharedTextureHandle {}
unsafe impl NSObjectProtocol for MTLSharedTextureHandle {}
unsafe impl NSSecureCoding for MTLSharedTextureHandle {}
extern_methods!(
unsafe impl MTLSharedTextureHandle {
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics Other device)]
pub fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
#[method_id(@__retain_semantics Other label)]
pub fn label(&self) -> Option<Retained<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLSharedTextureHandle {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTextureUsage(pub NSUInteger);
bitflags::bitflags! {
impl MTLTextureUsage: NSUInteger {
#[doc(alias = "MTLTextureUsageUnknown")]
const Unknown = 0x0000;
#[doc(alias = "MTLTextureUsageShaderRead")]
const ShaderRead = 0x0001;
#[doc(alias = "MTLTextureUsageShaderWrite")]
const ShaderWrite = 0x0002;
#[doc(alias = "MTLTextureUsageRenderTarget")]
const RenderTarget = 0x0004;
#[doc(alias = "MTLTextureUsagePixelFormatView")]
const PixelFormatView = 0x0010;
#[doc(alias = "MTLTextureUsageShaderAtomic")]
const ShaderAtomic = 0x0020;
}
}
unsafe impl Encode for MTLTextureUsage {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLTextureUsage {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTextureCompressionType(pub NSInteger);
impl MTLTextureCompressionType {
#[doc(alias = "MTLTextureCompressionTypeLossless")]
pub const Lossless: Self = Self(0);
#[doc(alias = "MTLTextureCompressionTypeLossy")]
pub const Lossy: Self = Self(1);
}
unsafe impl Encode for MTLTextureCompressionType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MTLTextureCompressionType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLTextureDescriptor;
unsafe impl ClassType for MTLTextureDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLTextureDescriptor {}
unsafe impl NSObjectProtocol for MTLTextureDescriptor {}
extern_methods!(
unsafe impl MTLTextureDescriptor {
#[cfg(feature = "MTLPixelFormat")]
#[method_id(@__retain_semantics Other texture2DDescriptorWithPixelFormat:width:height:mipmapped:)]
pub unsafe fn texture2DDescriptorWithPixelFormat_width_height_mipmapped(
pixel_format: MTLPixelFormat,
width: NSUInteger,
height: NSUInteger,
mipmapped: bool,
) -> Retained<MTLTextureDescriptor>;
#[cfg(feature = "MTLPixelFormat")]
#[method_id(@__retain_semantics Other textureCubeDescriptorWithPixelFormat:size:mipmapped:)]
pub unsafe fn textureCubeDescriptorWithPixelFormat_size_mipmapped(
pixel_format: MTLPixelFormat,
size: NSUInteger,
mipmapped: bool,
) -> Retained<MTLTextureDescriptor>;
#[cfg(all(feature = "MTLPixelFormat", feature = "MTLResource"))]
#[method_id(@__retain_semantics Other textureBufferDescriptorWithPixelFormat:width:resourceOptions:usage:)]
pub unsafe fn textureBufferDescriptorWithPixelFormat_width_resourceOptions_usage(
pixel_format: MTLPixelFormat,
width: NSUInteger,
resource_options: MTLResourceOptions,
usage: MTLTextureUsage,
) -> Retained<MTLTextureDescriptor>;
#[method(textureType)]
pub fn textureType(&self) -> MTLTextureType;
#[method(setTextureType:)]
pub fn setTextureType(&self, texture_type: MTLTextureType);
#[cfg(feature = "MTLPixelFormat")]
#[method(pixelFormat)]
pub fn pixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
#[method(setPixelFormat:)]
pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
#[method(width)]
pub fn width(&self) -> NSUInteger;
#[method(setWidth:)]
pub unsafe fn setWidth(&self, width: NSUInteger);
#[method(height)]
pub fn height(&self) -> NSUInteger;
#[method(setHeight:)]
pub unsafe fn setHeight(&self, height: NSUInteger);
#[method(depth)]
pub fn depth(&self) -> NSUInteger;
#[method(setDepth:)]
pub unsafe fn setDepth(&self, depth: NSUInteger);
#[method(mipmapLevelCount)]
pub fn mipmapLevelCount(&self) -> NSUInteger;
#[method(setMipmapLevelCount:)]
pub unsafe fn setMipmapLevelCount(&self, mipmap_level_count: NSUInteger);
#[method(sampleCount)]
pub fn sampleCount(&self) -> NSUInteger;
#[method(setSampleCount:)]
pub unsafe fn setSampleCount(&self, sample_count: NSUInteger);
#[method(arrayLength)]
pub fn arrayLength(&self) -> NSUInteger;
#[method(setArrayLength:)]
pub unsafe fn setArrayLength(&self, array_length: NSUInteger);
#[cfg(feature = "MTLResource")]
#[method(resourceOptions)]
pub fn resourceOptions(&self) -> MTLResourceOptions;
#[cfg(feature = "MTLResource")]
#[method(setResourceOptions:)]
pub fn setResourceOptions(&self, resource_options: MTLResourceOptions);
#[cfg(feature = "MTLResource")]
#[method(cpuCacheMode)]
pub fn cpuCacheMode(&self) -> MTLCPUCacheMode;
#[cfg(feature = "MTLResource")]
#[method(setCpuCacheMode:)]
pub fn setCpuCacheMode(&self, cpu_cache_mode: MTLCPUCacheMode);
#[cfg(feature = "MTLResource")]
#[method(storageMode)]
pub fn storageMode(&self) -> MTLStorageMode;
#[cfg(feature = "MTLResource")]
#[method(setStorageMode:)]
pub fn setStorageMode(&self, storage_mode: MTLStorageMode);
#[cfg(feature = "MTLResource")]
#[method(hazardTrackingMode)]
pub fn hazardTrackingMode(&self) -> MTLHazardTrackingMode;
#[cfg(feature = "MTLResource")]
#[method(setHazardTrackingMode:)]
pub fn setHazardTrackingMode(&self, hazard_tracking_mode: MTLHazardTrackingMode);
#[method(usage)]
pub fn usage(&self) -> MTLTextureUsage;
#[method(setUsage:)]
pub fn setUsage(&self, usage: MTLTextureUsage);
#[method(allowGPUOptimizedContents)]
pub fn allowGPUOptimizedContents(&self) -> bool;
#[method(setAllowGPUOptimizedContents:)]
pub fn setAllowGPUOptimizedContents(&self, allow_gpu_optimized_contents: bool);
#[method(compressionType)]
pub unsafe fn compressionType(&self) -> MTLTextureCompressionType;
#[method(setCompressionType:)]
pub unsafe fn setCompressionType(&self, compression_type: MTLTextureCompressionType);
#[method(swizzle)]
pub fn swizzle(&self) -> MTLTextureSwizzleChannels;
#[method(setSwizzle:)]
pub fn setSwizzle(&self, swizzle: MTLTextureSwizzleChannels);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLTextureDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
#[cfg(feature = "MTLResource")]
pub unsafe trait MTLTexture: MTLResource + IsRetainable {
#[deprecated = "Use parentTexture or buffer instead"]
#[method_id(@__retain_semantics Other rootResource)]
fn rootResource(&self) -> Option<Retained<ProtocolObject<dyn MTLResource>>>;
#[method_id(@__retain_semantics Other parentTexture)]
fn parentTexture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[method(parentRelativeLevel)]
fn parentRelativeLevel(&self) -> NSUInteger;
#[method(parentRelativeSlice)]
fn parentRelativeSlice(&self) -> NSUInteger;
#[cfg(feature = "MTLBuffer")]
#[method_id(@__retain_semantics Other buffer)]
fn buffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[method(bufferOffset)]
fn bufferOffset(&self) -> NSUInteger;
#[method(bufferBytesPerRow)]
fn bufferBytesPerRow(&self) -> NSUInteger;
#[method(iosurfacePlane)]
fn iosurfacePlane(&self) -> NSUInteger;
#[method(textureType)]
fn textureType(&self) -> MTLTextureType;
#[cfg(feature = "MTLPixelFormat")]
#[method(pixelFormat)]
fn pixelFormat(&self) -> MTLPixelFormat;
#[method(width)]
fn width(&self) -> NSUInteger;
#[method(height)]
fn height(&self) -> NSUInteger;
#[method(depth)]
fn depth(&self) -> NSUInteger;
#[method(mipmapLevelCount)]
fn mipmapLevelCount(&self) -> NSUInteger;
#[method(sampleCount)]
fn sampleCount(&self) -> NSUInteger;
#[method(arrayLength)]
fn arrayLength(&self) -> NSUInteger;
#[method(usage)]
fn usage(&self) -> MTLTextureUsage;
#[method(isShareable)]
fn isShareable(&self) -> bool;
#[method(isFramebufferOnly)]
fn isFramebufferOnly(&self) -> bool;
#[optional]
#[method(firstMipmapInTail)]
fn firstMipmapInTail(&self) -> NSUInteger;
#[optional]
#[method(tailSizeInBytes)]
fn tailSizeInBytes(&self) -> NSUInteger;
#[optional]
#[method(isSparse)]
fn isSparse(&self) -> bool;
#[method(allowGPUOptimizedContents)]
fn allowGPUOptimizedContents(&self) -> bool;
#[method(compressionType)]
unsafe fn compressionType(&self) -> MTLTextureCompressionType;
#[cfg(feature = "MTLTypes")]
#[method(gpuResourceID)]
unsafe fn gpuResourceID(&self) -> MTLResourceID;
#[cfg(feature = "MTLTypes")]
#[method(getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice:)]
unsafe fn getBytes_bytesPerRow_bytesPerImage_fromRegion_mipmapLevel_slice(
&self,
pixel_bytes: NonNull<c_void>,
bytes_per_row: NSUInteger,
bytes_per_image: NSUInteger,
region: MTLRegion,
level: NSUInteger,
slice: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:)]
unsafe fn replaceRegion_mipmapLevel_slice_withBytes_bytesPerRow_bytesPerImage(
&self,
region: MTLRegion,
level: NSUInteger,
slice: NSUInteger,
pixel_bytes: NonNull<c_void>,
bytes_per_row: NSUInteger,
bytes_per_image: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(getBytes:bytesPerRow:fromRegion:mipmapLevel:)]
unsafe fn getBytes_bytesPerRow_fromRegion_mipmapLevel(
&self,
pixel_bytes: NonNull<c_void>,
bytes_per_row: NSUInteger,
region: MTLRegion,
level: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
#[method(replaceRegion:mipmapLevel:withBytes:bytesPerRow:)]
unsafe fn replaceRegion_mipmapLevel_withBytes_bytesPerRow(
&self,
region: MTLRegion,
level: NSUInteger,
pixel_bytes: NonNull<c_void>,
bytes_per_row: NSUInteger,
);
#[cfg(feature = "MTLPixelFormat")]
#[method_id(@__retain_semantics New newTextureViewWithPixelFormat:)]
fn newTextureViewWithPixelFormat(
&self,
pixel_format: MTLPixelFormat,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(feature = "MTLPixelFormat")]
#[method_id(@__retain_semantics New newTextureViewWithPixelFormat:textureType:levels:slices:)]
unsafe fn newTextureViewWithPixelFormat_textureType_levels_slices(
&self,
pixel_format: MTLPixelFormat,
texture_type: MTLTextureType,
level_range: NSRange,
slice_range: NSRange,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[method_id(@__retain_semantics New newSharedTextureHandle)]
fn newSharedTextureHandle(&self) -> Option<Retained<MTLSharedTextureHandle>>;
#[method_id(@__retain_semantics Other remoteStorageTexture)]
fn remoteStorageTexture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(feature = "MTLDevice")]
#[method_id(@__retain_semantics New newRemoteTextureViewForDevice:)]
unsafe fn newRemoteTextureViewForDevice(
&self,
device: &ProtocolObject<dyn MTLDevice>,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[method(swizzle)]
fn swizzle(&self) -> MTLTextureSwizzleChannels;
#[cfg(feature = "MTLPixelFormat")]
#[method_id(@__retain_semantics New newTextureViewWithPixelFormat:textureType:levels:slices:swizzle:)]
unsafe fn newTextureViewWithPixelFormat_textureType_levels_slices_swizzle(
&self,
pixel_format: MTLPixelFormat,
texture_type: MTLTextureType,
level_range: NSRange,
slice_range: NSRange,
swizzle: MTLTextureSwizzleChannels,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
}
#[cfg(feature = "MTLResource")]
unsafe impl ProtocolType for dyn MTLTexture {}
);

View File

@@ -0,0 +1,111 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLOrigin {
pub x: NSUInteger,
pub y: NSUInteger,
pub z: NSUInteger,
}
unsafe impl Encode for MTLOrigin {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<NSUInteger>::ENCODING,
<NSUInteger>::ENCODING,
<NSUInteger>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLOrigin {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLOriginMake(x: NSUInteger,y: NSUInteger,z: NSUInteger,) -> MTLOrigin;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLSize {
pub width: NSUInteger,
pub height: NSUInteger,
pub depth: NSUInteger,
}
unsafe impl Encode for MTLSize {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<NSUInteger>::ENCODING,
<NSUInteger>::ENCODING,
<NSUInteger>::ENCODING,
],
);
}
unsafe impl RefEncode for MTLSize {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLSizeMake(width: NSUInteger,height: NSUInteger,depth: NSUInteger,) -> MTLSize;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLRegion {
pub origin: MTLOrigin,
pub size: MTLSize,
}
unsafe impl Encode for MTLRegion {
const ENCODING: Encoding = Encoding::Struct("?", &[<MTLOrigin>::ENCODING, <MTLSize>::ENCODING]);
}
unsafe impl RefEncode for MTLRegion {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLRegionMake1D(x: NSUInteger,width: NSUInteger,) -> MTLRegion;
// TODO: pub fn MTLRegionMake2D(x: NSUInteger,y: NSUInteger,width: NSUInteger,height: NSUInteger,) -> MTLRegion;
// TODO: pub fn MTLRegionMake3D(x: NSUInteger,y: NSUInteger,z: NSUInteger,width: NSUInteger,height: NSUInteger,depth: NSUInteger,) -> MTLRegion;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLSamplePosition {
pub x: c_float,
pub y: c_float,
}
unsafe impl Encode for MTLSamplePosition {
const ENCODING: Encoding = Encoding::Struct("?", &[<c_float>::ENCODING, <c_float>::ENCODING]);
}
unsafe impl RefEncode for MTLSamplePosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn MTLSamplePositionMake(x: c_float,y: c_float,) -> MTLSamplePosition;
pub type MTLCoordinate2D = MTLSamplePosition;
// TODO: pub fn MTLCoordinate2DMake(x: c_float,y: c_float,) -> MTLCoordinate2D;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLResourceID {
_impl: u64,
}
unsafe impl Encode for MTLResourceID {
const ENCODING: Encoding = Encoding::Struct("MTLResourceID", &[<u64>::ENCODING]);
}
unsafe impl RefEncode for MTLResourceID {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

View File

@@ -0,0 +1,385 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLVertexFormat(pub NSUInteger);
impl MTLVertexFormat {
#[doc(alias = "MTLVertexFormatInvalid")]
pub const Invalid: Self = Self(0);
#[doc(alias = "MTLVertexFormatUChar2")]
pub const UChar2: Self = Self(1);
#[doc(alias = "MTLVertexFormatUChar3")]
pub const UChar3: Self = Self(2);
#[doc(alias = "MTLVertexFormatUChar4")]
pub const UChar4: Self = Self(3);
#[doc(alias = "MTLVertexFormatChar2")]
pub const Char2: Self = Self(4);
#[doc(alias = "MTLVertexFormatChar3")]
pub const Char3: Self = Self(5);
#[doc(alias = "MTLVertexFormatChar4")]
pub const Char4: Self = Self(6);
#[doc(alias = "MTLVertexFormatUChar2Normalized")]
pub const UChar2Normalized: Self = Self(7);
#[doc(alias = "MTLVertexFormatUChar3Normalized")]
pub const UChar3Normalized: Self = Self(8);
#[doc(alias = "MTLVertexFormatUChar4Normalized")]
pub const UChar4Normalized: Self = Self(9);
#[doc(alias = "MTLVertexFormatChar2Normalized")]
pub const Char2Normalized: Self = Self(10);
#[doc(alias = "MTLVertexFormatChar3Normalized")]
pub const Char3Normalized: Self = Self(11);
#[doc(alias = "MTLVertexFormatChar4Normalized")]
pub const Char4Normalized: Self = Self(12);
#[doc(alias = "MTLVertexFormatUShort2")]
pub const UShort2: Self = Self(13);
#[doc(alias = "MTLVertexFormatUShort3")]
pub const UShort3: Self = Self(14);
#[doc(alias = "MTLVertexFormatUShort4")]
pub const UShort4: Self = Self(15);
#[doc(alias = "MTLVertexFormatShort2")]
pub const Short2: Self = Self(16);
#[doc(alias = "MTLVertexFormatShort3")]
pub const Short3: Self = Self(17);
#[doc(alias = "MTLVertexFormatShort4")]
pub const Short4: Self = Self(18);
#[doc(alias = "MTLVertexFormatUShort2Normalized")]
pub const UShort2Normalized: Self = Self(19);
#[doc(alias = "MTLVertexFormatUShort3Normalized")]
pub const UShort3Normalized: Self = Self(20);
#[doc(alias = "MTLVertexFormatUShort4Normalized")]
pub const UShort4Normalized: Self = Self(21);
#[doc(alias = "MTLVertexFormatShort2Normalized")]
pub const Short2Normalized: Self = Self(22);
#[doc(alias = "MTLVertexFormatShort3Normalized")]
pub const Short3Normalized: Self = Self(23);
#[doc(alias = "MTLVertexFormatShort4Normalized")]
pub const Short4Normalized: Self = Self(24);
#[doc(alias = "MTLVertexFormatHalf2")]
pub const Half2: Self = Self(25);
#[doc(alias = "MTLVertexFormatHalf3")]
pub const Half3: Self = Self(26);
#[doc(alias = "MTLVertexFormatHalf4")]
pub const Half4: Self = Self(27);
#[doc(alias = "MTLVertexFormatFloat")]
pub const Float: Self = Self(28);
#[doc(alias = "MTLVertexFormatFloat2")]
pub const Float2: Self = Self(29);
#[doc(alias = "MTLVertexFormatFloat3")]
pub const Float3: Self = Self(30);
#[doc(alias = "MTLVertexFormatFloat4")]
pub const Float4: Self = Self(31);
#[doc(alias = "MTLVertexFormatInt")]
pub const Int: Self = Self(32);
#[doc(alias = "MTLVertexFormatInt2")]
pub const Int2: Self = Self(33);
#[doc(alias = "MTLVertexFormatInt3")]
pub const Int3: Self = Self(34);
#[doc(alias = "MTLVertexFormatInt4")]
pub const Int4: Self = Self(35);
#[doc(alias = "MTLVertexFormatUInt")]
pub const UInt: Self = Self(36);
#[doc(alias = "MTLVertexFormatUInt2")]
pub const UInt2: Self = Self(37);
#[doc(alias = "MTLVertexFormatUInt3")]
pub const UInt3: Self = Self(38);
#[doc(alias = "MTLVertexFormatUInt4")]
pub const UInt4: Self = Self(39);
#[doc(alias = "MTLVertexFormatInt1010102Normalized")]
pub const Int1010102Normalized: Self = Self(40);
#[doc(alias = "MTLVertexFormatUInt1010102Normalized")]
pub const UInt1010102Normalized: Self = Self(41);
#[doc(alias = "MTLVertexFormatUChar4Normalized_BGRA")]
pub const UChar4Normalized_BGRA: Self = Self(42);
#[doc(alias = "MTLVertexFormatUChar")]
pub const UChar: Self = Self(45);
#[doc(alias = "MTLVertexFormatChar")]
pub const Char: Self = Self(46);
#[doc(alias = "MTLVertexFormatUCharNormalized")]
pub const UCharNormalized: Self = Self(47);
#[doc(alias = "MTLVertexFormatCharNormalized")]
pub const CharNormalized: Self = Self(48);
#[doc(alias = "MTLVertexFormatUShort")]
pub const UShort: Self = Self(49);
#[doc(alias = "MTLVertexFormatShort")]
pub const Short: Self = Self(50);
#[doc(alias = "MTLVertexFormatUShortNormalized")]
pub const UShortNormalized: Self = Self(51);
#[doc(alias = "MTLVertexFormatShortNormalized")]
pub const ShortNormalized: Self = Self(52);
#[doc(alias = "MTLVertexFormatHalf")]
pub const Half: Self = Self(53);
#[doc(alias = "MTLVertexFormatFloatRG11B10")]
pub const FloatRG11B10: Self = Self(54);
#[doc(alias = "MTLVertexFormatFloatRGB9E5")]
pub const FloatRGB9E5: Self = Self(55);
}
unsafe impl Encode for MTLVertexFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLVertexFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLVertexStepFunction(pub NSUInteger);
impl MTLVertexStepFunction {
#[doc(alias = "MTLVertexStepFunctionConstant")]
pub const Constant: Self = Self(0);
#[doc(alias = "MTLVertexStepFunctionPerVertex")]
pub const PerVertex: Self = Self(1);
#[doc(alias = "MTLVertexStepFunctionPerInstance")]
pub const PerInstance: Self = Self(2);
#[doc(alias = "MTLVertexStepFunctionPerPatch")]
pub const PerPatch: Self = Self(3);
#[doc(alias = "MTLVertexStepFunctionPerPatchControlPoint")]
pub const PerPatchControlPoint: Self = Self(4);
}
unsafe impl Encode for MTLVertexStepFunction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLVertexStepFunction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static MTLBufferLayoutStrideDynamic: NSUInteger = NSUIntegerMax as _;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexBufferLayoutDescriptor;
unsafe impl ClassType for MTLVertexBufferLayoutDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLVertexBufferLayoutDescriptor {}
unsafe impl NSObjectProtocol for MTLVertexBufferLayoutDescriptor {}
extern_methods!(
unsafe impl MTLVertexBufferLayoutDescriptor {
#[method(stride)]
pub fn stride(&self) -> NSUInteger;
#[method(setStride:)]
pub unsafe fn setStride(&self, stride: NSUInteger);
#[method(stepFunction)]
pub fn stepFunction(&self) -> MTLVertexStepFunction;
#[method(setStepFunction:)]
pub unsafe fn setStepFunction(&self, step_function: MTLVertexStepFunction);
#[method(stepRate)]
pub fn stepRate(&self) -> NSUInteger;
#[method(setStepRate:)]
pub unsafe fn setStepRate(&self, step_rate: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVertexBufferLayoutDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLVertexBufferLayoutDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexBufferLayoutDescriptorArray;
unsafe impl ClassType for MTLVertexBufferLayoutDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLVertexBufferLayoutDescriptorArray {}
extern_methods!(
unsafe impl MTLVertexBufferLayoutDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
index: NSUInteger,
) -> Retained<MTLVertexBufferLayoutDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
buffer_desc: Option<&MTLVertexBufferLayoutDescriptor>,
index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVertexBufferLayoutDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexAttributeDescriptor;
unsafe impl ClassType for MTLVertexAttributeDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLVertexAttributeDescriptor {}
unsafe impl NSObjectProtocol for MTLVertexAttributeDescriptor {}
extern_methods!(
unsafe impl MTLVertexAttributeDescriptor {
#[method(format)]
pub fn format(&self) -> MTLVertexFormat;
#[method(setFormat:)]
pub fn setFormat(&self, format: MTLVertexFormat);
#[method(offset)]
pub fn offset(&self) -> NSUInteger;
#[method(setOffset:)]
pub unsafe fn setOffset(&self, offset: NSUInteger);
#[method(bufferIndex)]
pub fn bufferIndex(&self) -> NSUInteger;
#[method(setBufferIndex:)]
pub unsafe fn setBufferIndex(&self, buffer_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVertexAttributeDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for MTLVertexAttributeDescriptor {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexAttributeDescriptorArray;
unsafe impl ClassType for MTLVertexAttributeDescriptorArray {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for MTLVertexAttributeDescriptorArray {}
extern_methods!(
unsafe impl MTLVertexAttributeDescriptorArray {
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(
&self,
index: NSUInteger,
) -> Retained<MTLVertexAttributeDescriptor>;
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attribute_desc: Option<&MTLVertexAttributeDescriptor>,
index: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVertexAttributeDescriptorArray {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVertexDescriptor;
unsafe impl ClassType for MTLVertexDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLVertexDescriptor {}
unsafe impl NSObjectProtocol for MTLVertexDescriptor {}
extern_methods!(
unsafe impl MTLVertexDescriptor {
#[method_id(@__retain_semantics Other vertexDescriptor)]
pub fn vertexDescriptor() -> Retained<MTLVertexDescriptor>;
#[method_id(@__retain_semantics Other layouts)]
pub fn layouts(&self) -> Retained<MTLVertexBufferLayoutDescriptorArray>;
#[method_id(@__retain_semantics Other attributes)]
pub fn attributes(&self) -> Retained<MTLVertexAttributeDescriptorArray>;
#[method(reset)]
pub fn reset(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVertexDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,72 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLVisibleFunctionTableDescriptor;
unsafe impl ClassType for MTLVisibleFunctionTableDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for MTLVisibleFunctionTableDescriptor {}
unsafe impl NSObjectProtocol for MTLVisibleFunctionTableDescriptor {}
extern_methods!(
unsafe impl MTLVisibleFunctionTableDescriptor {
#[method_id(@__retain_semantics Other visibleFunctionTableDescriptor)]
pub unsafe fn visibleFunctionTableDescriptor() -> Retained<MTLVisibleFunctionTableDescriptor>;
#[method(functionCount)]
pub unsafe fn functionCount(&self) -> NSUInteger;
#[method(setFunctionCount:)]
pub unsafe fn setFunctionCount(&self, function_count: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl MTLVisibleFunctionTableDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
#[cfg(feature = "MTLResource")]
pub unsafe trait MTLVisibleFunctionTable: MTLResource + IsRetainable {
#[cfg(feature = "MTLTypes")]
#[method(gpuResourceID)]
unsafe fn gpuResourceID(&self) -> MTLResourceID;
#[cfg(feature = "MTLFunctionHandle")]
#[method(setFunction:atIndex:)]
unsafe fn setFunction_atIndex(
&self,
function: Option<&ProtocolObject<dyn MTLFunctionHandle>>,
index: NSUInteger,
);
#[cfg(feature = "MTLFunctionHandle")]
#[method(setFunctions:withRange:)]
unsafe fn setFunctions_withRange(
&self,
functions: NonNull<*const ProtocolObject<dyn MTLFunctionHandle>>,
range: NSRange,
);
}
#[cfg(feature = "MTLResource")]
unsafe impl ProtocolType for dyn MTLVisibleFunctionTable {}
);

891
vendor/objc2-metal/src/generated/mod.rs vendored Normal file
View File

@@ -0,0 +1,891 @@
// This file has been automatically generated by `objc2`'s `header-translator`.
// DO NOT EDIT
#![allow(unused_imports)]
#![allow(deprecated)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(missing_docs)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
#[link(name = "Metal", kind = "framework")]
extern "C" {}
#[cfg(feature = "MTLAccelerationStructure")]
#[path = "MTLAccelerationStructure.rs"]
mod __MTLAccelerationStructure;
#[cfg(feature = "MTLAccelerationStructureCommandEncoder")]
#[path = "MTLAccelerationStructureCommandEncoder.rs"]
mod __MTLAccelerationStructureCommandEncoder;
#[cfg(feature = "MTLAccelerationStructureTypes")]
#[path = "MTLAccelerationStructureTypes.rs"]
mod __MTLAccelerationStructureTypes;
#[cfg(feature = "MTLArgument")]
#[path = "MTLArgument.rs"]
mod __MTLArgument;
#[cfg(feature = "MTLArgumentEncoder")]
#[path = "MTLArgumentEncoder.rs"]
mod __MTLArgumentEncoder;
#[cfg(feature = "MTLBinaryArchive")]
#[path = "MTLBinaryArchive.rs"]
mod __MTLBinaryArchive;
#[cfg(feature = "MTLBlitCommandEncoder")]
#[path = "MTLBlitCommandEncoder.rs"]
mod __MTLBlitCommandEncoder;
#[cfg(feature = "MTLBlitPass")]
#[path = "MTLBlitPass.rs"]
mod __MTLBlitPass;
#[cfg(feature = "MTLBuffer")]
#[path = "MTLBuffer.rs"]
mod __MTLBuffer;
#[cfg(feature = "MTLCaptureManager")]
#[path = "MTLCaptureManager.rs"]
mod __MTLCaptureManager;
#[cfg(feature = "MTLCaptureScope")]
#[path = "MTLCaptureScope.rs"]
mod __MTLCaptureScope;
#[cfg(feature = "MTLCommandBuffer")]
#[path = "MTLCommandBuffer.rs"]
mod __MTLCommandBuffer;
#[cfg(feature = "MTLCommandEncoder")]
#[path = "MTLCommandEncoder.rs"]
mod __MTLCommandEncoder;
#[cfg(feature = "MTLCommandQueue")]
#[path = "MTLCommandQueue.rs"]
mod __MTLCommandQueue;
#[cfg(feature = "MTLComputeCommandEncoder")]
#[path = "MTLComputeCommandEncoder.rs"]
mod __MTLComputeCommandEncoder;
#[cfg(feature = "MTLComputePass")]
#[path = "MTLComputePass.rs"]
mod __MTLComputePass;
#[cfg(feature = "MTLComputePipeline")]
#[path = "MTLComputePipeline.rs"]
mod __MTLComputePipeline;
#[cfg(feature = "MTLCounters")]
#[path = "MTLCounters.rs"]
mod __MTLCounters;
#[cfg(feature = "MTLDefines")]
#[path = "MTLDefines.rs"]
mod __MTLDefines;
#[cfg(feature = "MTLDepthStencil")]
#[path = "MTLDepthStencil.rs"]
mod __MTLDepthStencil;
#[cfg(feature = "MTLDevice")]
#[path = "MTLDevice.rs"]
mod __MTLDevice;
#[cfg(feature = "MTLDrawable")]
#[path = "MTLDrawable.rs"]
mod __MTLDrawable;
#[cfg(feature = "MTLDynamicLibrary")]
#[path = "MTLDynamicLibrary.rs"]
mod __MTLDynamicLibrary;
#[cfg(feature = "MTLEvent")]
#[path = "MTLEvent.rs"]
mod __MTLEvent;
#[cfg(feature = "MTLFence")]
#[path = "MTLFence.rs"]
mod __MTLFence;
#[cfg(feature = "MTLFunctionConstantValues")]
#[path = "MTLFunctionConstantValues.rs"]
mod __MTLFunctionConstantValues;
#[cfg(feature = "MTLFunctionDescriptor")]
#[path = "MTLFunctionDescriptor.rs"]
mod __MTLFunctionDescriptor;
#[cfg(feature = "MTLFunctionHandle")]
#[path = "MTLFunctionHandle.rs"]
mod __MTLFunctionHandle;
#[cfg(feature = "MTLFunctionLog")]
#[path = "MTLFunctionLog.rs"]
mod __MTLFunctionLog;
#[cfg(feature = "MTLFunctionStitching")]
#[path = "MTLFunctionStitching.rs"]
mod __MTLFunctionStitching;
#[cfg(feature = "MTLHeap")]
#[path = "MTLHeap.rs"]
mod __MTLHeap;
#[cfg(feature = "MTLIOCommandBuffer")]
#[path = "MTLIOCommandBuffer.rs"]
mod __MTLIOCommandBuffer;
#[cfg(feature = "MTLIOCommandQueue")]
#[path = "MTLIOCommandQueue.rs"]
mod __MTLIOCommandQueue;
#[cfg(feature = "MTLIOCompressor")]
#[path = "MTLIOCompressor.rs"]
mod __MTLIOCompressor;
#[cfg(feature = "MTLIndirectCommandBuffer")]
#[path = "MTLIndirectCommandBuffer.rs"]
mod __MTLIndirectCommandBuffer;
#[cfg(feature = "MTLIndirectCommandEncoder")]
#[path = "MTLIndirectCommandEncoder.rs"]
mod __MTLIndirectCommandEncoder;
#[cfg(feature = "MTLIntersectionFunctionTable")]
#[path = "MTLIntersectionFunctionTable.rs"]
mod __MTLIntersectionFunctionTable;
#[cfg(feature = "MTLLibrary")]
#[path = "MTLLibrary.rs"]
mod __MTLLibrary;
#[cfg(feature = "MTLLinkedFunctions")]
#[path = "MTLLinkedFunctions.rs"]
mod __MTLLinkedFunctions;
#[cfg(feature = "MTLParallelRenderCommandEncoder")]
#[path = "MTLParallelRenderCommandEncoder.rs"]
mod __MTLParallelRenderCommandEncoder;
#[cfg(feature = "MTLPipeline")]
#[path = "MTLPipeline.rs"]
mod __MTLPipeline;
#[cfg(feature = "MTLPixelFormat")]
#[path = "MTLPixelFormat.rs"]
mod __MTLPixelFormat;
#[cfg(feature = "MTLRasterizationRate")]
#[path = "MTLRasterizationRate.rs"]
mod __MTLRasterizationRate;
#[cfg(feature = "MTLRenderCommandEncoder")]
#[path = "MTLRenderCommandEncoder.rs"]
mod __MTLRenderCommandEncoder;
#[cfg(feature = "MTLRenderPass")]
#[path = "MTLRenderPass.rs"]
mod __MTLRenderPass;
#[cfg(feature = "MTLRenderPipeline")]
#[path = "MTLRenderPipeline.rs"]
mod __MTLRenderPipeline;
#[cfg(feature = "MTLResource")]
#[path = "MTLResource.rs"]
mod __MTLResource;
#[cfg(feature = "MTLResourceStateCommandEncoder")]
#[path = "MTLResourceStateCommandEncoder.rs"]
mod __MTLResourceStateCommandEncoder;
#[cfg(feature = "MTLResourceStatePass")]
#[path = "MTLResourceStatePass.rs"]
mod __MTLResourceStatePass;
#[cfg(feature = "MTLSampler")]
#[path = "MTLSampler.rs"]
mod __MTLSampler;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
#[path = "MTLStageInputOutputDescriptor.rs"]
mod __MTLStageInputOutputDescriptor;
#[cfg(feature = "MTLTexture")]
#[path = "MTLTexture.rs"]
mod __MTLTexture;
#[cfg(feature = "MTLTypes")]
#[path = "MTLTypes.rs"]
mod __MTLTypes;
#[cfg(feature = "MTLVertexDescriptor")]
#[path = "MTLVertexDescriptor.rs"]
mod __MTLVertexDescriptor;
#[cfg(feature = "MTLVisibleFunctionTable")]
#[path = "MTLVisibleFunctionTable.rs"]
mod __MTLVisibleFunctionTable;
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLResource"))]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructure;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureBoundingBoxGeometryDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureCurveGeometryDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureGeometryDescriptor;
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLAccelerationStructureTypes"
))]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureInstanceDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureInstanceDescriptorType;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureInstanceOptions;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureMotionCurveGeometryDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureMotionInstanceDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureMotionTriangleGeometryDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureTriangleGeometryDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureUsage;
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLAccelerationStructureTypes"
))]
pub use self::__MTLAccelerationStructure::MTLAccelerationStructureUserIDInstanceDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLCurveBasis;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLCurveEndCaps;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLCurveType;
#[cfg(all(
feature = "MTLAccelerationStructure",
feature = "MTLAccelerationStructureTypes",
feature = "MTLTypes"
))]
pub use self::__MTLAccelerationStructure::MTLIndirectAccelerationStructureInstanceDescriptor;
#[cfg(all(feature = "MTLAccelerationStructure", feature = "MTLTypes"))]
pub use self::__MTLAccelerationStructure::MTLIndirectAccelerationStructureMotionInstanceDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLIndirectInstanceAccelerationStructureDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLInstanceAccelerationStructureDescriptor;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLMotionBorderMode;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLMotionKeyframeData;
#[cfg(feature = "MTLAccelerationStructure")]
pub use self::__MTLAccelerationStructure::MTLPrimitiveAccelerationStructureDescriptor;
#[cfg(all(
feature = "MTLAccelerationStructureCommandEncoder",
feature = "MTLCommandEncoder"
))]
pub use self::__MTLAccelerationStructureCommandEncoder::MTLAccelerationStructureCommandEncoder;
#[cfg(feature = "MTLAccelerationStructureCommandEncoder")]
pub use self::__MTLAccelerationStructureCommandEncoder::MTLAccelerationStructurePassDescriptor;
#[cfg(feature = "MTLAccelerationStructureCommandEncoder")]
pub use self::__MTLAccelerationStructureCommandEncoder::MTLAccelerationStructurePassSampleBufferAttachmentDescriptor;
#[cfg(feature = "MTLAccelerationStructureCommandEncoder")]
pub use self::__MTLAccelerationStructureCommandEncoder::MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray;
#[cfg(feature = "MTLAccelerationStructureCommandEncoder")]
pub use self::__MTLAccelerationStructureCommandEncoder::MTLAccelerationStructureRefitOptions;
#[cfg(feature = "MTLAccelerationStructureTypes")]
pub use self::__MTLAccelerationStructureTypes::MTLAxisAlignedBoundingBox;
#[cfg(feature = "MTLAccelerationStructureTypes")]
pub use self::__MTLAccelerationStructureTypes::MTLPackedFloat4x3;
#[cfg(feature = "MTLAccelerationStructureTypes")]
pub(crate) use self::__MTLAccelerationStructureTypes::_MTLAxisAlignedBoundingBox;
#[cfg(feature = "MTLAccelerationStructureTypes")]
pub(crate) use self::__MTLAccelerationStructureTypes::_MTLPackedFloat4x3;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLArgument;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLArgumentAccess;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLArgumentType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLArrayType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLBinding;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLBindingAccess;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLBindingType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLBufferBinding;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLDataType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLObjectPayloadBinding;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLPointerType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLStructMember;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLStructType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLTextureBinding;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLTextureReferenceType;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLThreadgroupBinding;
#[cfg(feature = "MTLArgument")]
pub use self::__MTLArgument::MTLType;
#[cfg(feature = "MTLArgumentEncoder")]
pub use self::__MTLArgumentEncoder::MTLArgumentEncoder;
#[cfg(feature = "MTLArgumentEncoder")]
pub use self::__MTLArgumentEncoder::MTLAttributeStrideStatic;
#[cfg(feature = "MTLBinaryArchive")]
pub use self::__MTLBinaryArchive::MTLBinaryArchive;
#[cfg(feature = "MTLBinaryArchive")]
pub use self::__MTLBinaryArchive::MTLBinaryArchiveDescriptor;
#[cfg(feature = "MTLBinaryArchive")]
pub use self::__MTLBinaryArchive::MTLBinaryArchiveDomain;
#[cfg(feature = "MTLBinaryArchive")]
pub use self::__MTLBinaryArchive::MTLBinaryArchiveError;
#[cfg(all(feature = "MTLBlitCommandEncoder", feature = "MTLCommandEncoder"))]
pub use self::__MTLBlitCommandEncoder::MTLBlitCommandEncoder;
#[cfg(feature = "MTLBlitCommandEncoder")]
pub use self::__MTLBlitCommandEncoder::MTLBlitOption;
#[cfg(feature = "MTLBlitPass")]
pub use self::__MTLBlitPass::MTLBlitPassDescriptor;
#[cfg(feature = "MTLBlitPass")]
pub use self::__MTLBlitPass::MTLBlitPassSampleBufferAttachmentDescriptor;
#[cfg(feature = "MTLBlitPass")]
pub use self::__MTLBlitPass::MTLBlitPassSampleBufferAttachmentDescriptorArray;
#[cfg(all(feature = "MTLBuffer", feature = "MTLResource"))]
pub use self::__MTLBuffer::MTLBuffer;
#[cfg(feature = "MTLCaptureManager")]
pub use self::__MTLCaptureManager::MTLCaptureDescriptor;
#[cfg(feature = "MTLCaptureManager")]
pub use self::__MTLCaptureManager::MTLCaptureDestination;
#[cfg(feature = "MTLCaptureManager")]
pub use self::__MTLCaptureManager::MTLCaptureError;
#[cfg(feature = "MTLCaptureManager")]
pub use self::__MTLCaptureManager::MTLCaptureErrorDomain;
#[cfg(feature = "MTLCaptureManager")]
pub use self::__MTLCaptureManager::MTLCaptureManager;
#[cfg(feature = "MTLCaptureScope")]
pub use self::__MTLCaptureScope::MTLCaptureScope;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBuffer;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferDescriptor;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferEncoderInfo;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferEncoderInfoErrorKey;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferError;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferErrorDomain;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferErrorOption;
#[cfg(all(feature = "MTLCommandBuffer", feature = "block2"))]
pub use self::__MTLCommandBuffer::MTLCommandBufferHandler;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandBufferStatus;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLCommandEncoderErrorState;
#[cfg(feature = "MTLCommandBuffer")]
pub use self::__MTLCommandBuffer::MTLDispatchType;
#[cfg(feature = "MTLCommandEncoder")]
pub use self::__MTLCommandEncoder::MTLBarrierScope;
#[cfg(feature = "MTLCommandEncoder")]
pub use self::__MTLCommandEncoder::MTLCommandEncoder;
#[cfg(feature = "MTLCommandEncoder")]
pub use self::__MTLCommandEncoder::MTLResourceUsage;
#[cfg(feature = "MTLCommandQueue")]
pub use self::__MTLCommandQueue::MTLCommandQueue;
#[cfg(all(feature = "MTLCommandEncoder", feature = "MTLComputeCommandEncoder"))]
pub use self::__MTLComputeCommandEncoder::MTLComputeCommandEncoder;
#[cfg(feature = "MTLComputeCommandEncoder")]
pub use self::__MTLComputeCommandEncoder::MTLDispatchThreadgroupsIndirectArguments;
#[cfg(feature = "MTLComputeCommandEncoder")]
pub use self::__MTLComputeCommandEncoder::MTLStageInRegionIndirectArguments;
#[cfg(feature = "MTLComputePass")]
pub use self::__MTLComputePass::MTLComputePassDescriptor;
#[cfg(feature = "MTLComputePass")]
pub use self::__MTLComputePass::MTLComputePassSampleBufferAttachmentDescriptor;
#[cfg(feature = "MTLComputePass")]
pub use self::__MTLComputePass::MTLComputePassSampleBufferAttachmentDescriptorArray;
#[cfg(feature = "MTLComputePipeline")]
pub use self::__MTLComputePipeline::MTLComputePipelineDescriptor;
#[cfg(feature = "MTLComputePipeline")]
pub use self::__MTLComputePipeline::MTLComputePipelineReflection;
#[cfg(feature = "MTLComputePipeline")]
pub use self::__MTLComputePipeline::MTLComputePipelineState;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounter;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterClipperInvocations;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterClipperPrimitivesOut;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterComputeKernelInvocations;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterFragmentCycles;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterFragmentInvocations;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterFragmentsPassed;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterPostTessellationVertexCycles;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterPostTessellationVertexInvocations;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterRenderTargetWriteCycles;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterSet;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterSetStageUtilization;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterSetStatistic;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterSetTimestamp;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterTessellationCycles;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterTessellationInputPatches;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterTimestamp;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterTotalCycles;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterVertexCycles;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCommonCounterVertexInvocations;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounter;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterErrorDomain;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterResultStageUtilization;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterResultStatistic;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterResultTimestamp;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterSampleBuffer;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterSampleBufferDescriptor;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterSampleBufferError;
#[cfg(feature = "MTLCounters")]
pub use self::__MTLCounters::MTLCounterSet;
#[cfg(feature = "MTLDepthStencil")]
pub use self::__MTLDepthStencil::MTLCompareFunction;
#[cfg(feature = "MTLDepthStencil")]
pub use self::__MTLDepthStencil::MTLDepthStencilDescriptor;
#[cfg(feature = "MTLDepthStencil")]
pub use self::__MTLDepthStencil::MTLDepthStencilState;
#[cfg(feature = "MTLDepthStencil")]
pub use self::__MTLDepthStencil::MTLStencilDescriptor;
#[cfg(feature = "MTLDepthStencil")]
pub use self::__MTLDepthStencil::MTLStencilOperation;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLAccelerationStructureSizes;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLArchitecture;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLArgumentBuffersTier;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLArgumentDescriptor;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLCopyAllDevices;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLCounterSamplingPoint;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLCreateSystemDefaultDevice;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLDevice;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLDeviceLocation;
#[cfg(all(feature = "MTLDevice", feature = "block2"))]
pub use self::__MTLDevice::MTLDeviceNotificationHandler;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLDeviceNotificationName;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLDeviceRemovalRequestedNotification;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLDeviceWasAddedNotification;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLDeviceWasRemovedNotification;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLFeatureSet;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLGPUFamily;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLIOCompressionMethod;
#[cfg(all(
feature = "MTLComputePipeline",
feature = "MTLDevice",
feature = "block2"
))]
pub use self::__MTLDevice::MTLNewComputePipelineStateCompletionHandler;
#[cfg(all(
feature = "MTLComputePipeline",
feature = "MTLDevice",
feature = "block2"
))]
pub use self::__MTLDevice::MTLNewComputePipelineStateWithReflectionCompletionHandler;
#[cfg(all(feature = "MTLDevice", feature = "MTLLibrary", feature = "block2"))]
pub use self::__MTLDevice::MTLNewLibraryCompletionHandler;
#[cfg(all(
feature = "MTLDevice",
feature = "MTLRenderPipeline",
feature = "block2"
))]
pub use self::__MTLDevice::MTLNewRenderPipelineStateCompletionHandler;
#[cfg(all(
feature = "MTLDevice",
feature = "MTLRenderPipeline",
feature = "block2"
))]
pub use self::__MTLDevice::MTLNewRenderPipelineStateWithReflectionCompletionHandler;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLPipelineOption;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLReadWriteTextureTier;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLRemoveDeviceObserver;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLSizeAndAlign;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLSparsePageSize;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLSparseTextureRegionAlignmentMode;
#[cfg(feature = "MTLDevice")]
pub use self::__MTLDevice::MTLTimestamp;
#[cfg(feature = "MTLDrawable")]
pub use self::__MTLDrawable::MTLDrawable;
#[cfg(all(feature = "MTLDrawable", feature = "block2"))]
pub use self::__MTLDrawable::MTLDrawablePresentedHandler;
#[cfg(feature = "MTLDynamicLibrary")]
pub use self::__MTLDynamicLibrary::MTLDynamicLibrary;
#[cfg(feature = "MTLDynamicLibrary")]
pub use self::__MTLDynamicLibrary::MTLDynamicLibraryDomain;
#[cfg(feature = "MTLDynamicLibrary")]
pub use self::__MTLDynamicLibrary::MTLDynamicLibraryError;
#[cfg(feature = "MTLEvent")]
pub use self::__MTLEvent::MTLEvent;
#[cfg(feature = "MTLEvent")]
pub use self::__MTLEvent::MTLSharedEvent;
#[cfg(feature = "MTLEvent")]
pub use self::__MTLEvent::MTLSharedEventHandle;
#[cfg(feature = "MTLEvent")]
pub use self::__MTLEvent::MTLSharedEventListener;
#[cfg(all(feature = "MTLEvent", feature = "block2"))]
pub use self::__MTLEvent::MTLSharedEventNotificationBlock;
#[cfg(feature = "MTLFence")]
pub use self::__MTLFence::MTLFence;
#[cfg(feature = "MTLFunctionConstantValues")]
pub use self::__MTLFunctionConstantValues::MTLFunctionConstantValues;
#[cfg(feature = "MTLFunctionDescriptor")]
pub use self::__MTLFunctionDescriptor::MTLFunctionDescriptor;
#[cfg(feature = "MTLFunctionDescriptor")]
pub use self::__MTLFunctionDescriptor::MTLFunctionOptions;
#[cfg(feature = "MTLFunctionDescriptor")]
pub use self::__MTLFunctionDescriptor::MTLIntersectionFunctionDescriptor;
#[cfg(feature = "MTLFunctionHandle")]
pub use self::__MTLFunctionHandle::MTLFunctionHandle;
#[cfg(feature = "MTLFunctionLog")]
pub use self::__MTLFunctionLog::MTLFunctionLog;
#[cfg(feature = "MTLFunctionLog")]
pub use self::__MTLFunctionLog::MTLFunctionLogDebugLocation;
#[cfg(feature = "MTLFunctionLog")]
pub use self::__MTLFunctionLog::MTLFunctionLogType;
#[cfg(feature = "MTLFunctionLog")]
pub use self::__MTLFunctionLog::MTLLogContainer;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLFunctionStitchingAttribute;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLFunctionStitchingAttributeAlwaysInline;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLFunctionStitchingFunctionNode;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLFunctionStitchingGraph;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLFunctionStitchingInputNode;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLFunctionStitchingNode;
#[cfg(feature = "MTLFunctionStitching")]
pub use self::__MTLFunctionStitching::MTLStitchedLibraryDescriptor;
#[cfg(feature = "MTLHeap")]
pub use self::__MTLHeap::MTLHeap;
#[cfg(feature = "MTLHeap")]
pub use self::__MTLHeap::MTLHeapDescriptor;
#[cfg(feature = "MTLHeap")]
pub use self::__MTLHeap::MTLHeapType;
#[cfg(feature = "MTLIOCommandBuffer")]
pub use self::__MTLIOCommandBuffer::MTLIOCommandBuffer;
#[cfg(all(feature = "MTLIOCommandBuffer", feature = "block2"))]
pub use self::__MTLIOCommandBuffer::MTLIOCommandBufferHandler;
#[cfg(feature = "MTLIOCommandBuffer")]
pub use self::__MTLIOCommandBuffer::MTLIOStatus;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOCommandQueue;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOCommandQueueDescriptor;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOCommandQueueType;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOError;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOErrorDomain;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOFileHandle;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOPriority;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOScratchBuffer;
#[cfg(feature = "MTLIOCommandQueue")]
pub use self::__MTLIOCommandQueue::MTLIOScratchBufferAllocator;
#[cfg(feature = "MTLIOCompressor")]
pub use self::__MTLIOCompressor::MTLIOCompressionContext;
#[cfg(feature = "MTLIOCompressor")]
pub use self::__MTLIOCompressor::MTLIOCompressionContextAppendData;
#[cfg(feature = "MTLIOCompressor")]
pub use self::__MTLIOCompressor::MTLIOCompressionContextDefaultChunkSize;
#[cfg(feature = "MTLIOCompressor")]
pub use self::__MTLIOCompressor::MTLIOCompressionStatus;
#[cfg(all(feature = "MTLDevice", feature = "MTLIOCompressor"))]
pub use self::__MTLIOCompressor::MTLIOCreateCompressionContext;
#[cfg(feature = "MTLIOCompressor")]
pub use self::__MTLIOCompressor::MTLIOFlushAndDestroyCompressionContext;
#[cfg(all(feature = "MTLIndirectCommandBuffer", feature = "MTLResource"))]
pub use self::__MTLIndirectCommandBuffer::MTLIndirectCommandBuffer;
#[cfg(feature = "MTLIndirectCommandBuffer")]
pub use self::__MTLIndirectCommandBuffer::MTLIndirectCommandBufferDescriptor;
#[cfg(feature = "MTLIndirectCommandBuffer")]
pub use self::__MTLIndirectCommandBuffer::MTLIndirectCommandBufferExecutionRange;
#[cfg(feature = "MTLIndirectCommandBuffer")]
pub use self::__MTLIndirectCommandBuffer::MTLIndirectCommandType;
#[cfg(feature = "MTLIndirectCommandEncoder")]
pub use self::__MTLIndirectCommandEncoder::MTLIndirectComputeCommand;
#[cfg(feature = "MTLIndirectCommandEncoder")]
pub use self::__MTLIndirectCommandEncoder::MTLIndirectRenderCommand;
#[cfg(feature = "MTLIntersectionFunctionTable")]
pub use self::__MTLIntersectionFunctionTable::MTLIntersectionFunctionSignature;
#[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
pub use self::__MTLIntersectionFunctionTable::MTLIntersectionFunctionTable;
#[cfg(feature = "MTLIntersectionFunctionTable")]
pub use self::__MTLIntersectionFunctionTable::MTLIntersectionFunctionTableDescriptor;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLAttribute;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLCompileOptions;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLCompileSymbolVisibility;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLFunction;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLFunctionConstant;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLFunctionType;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLLanguageVersion;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLLibrary;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLLibraryError;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLLibraryErrorDomain;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLLibraryOptimizationLevel;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLLibraryType;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLPatchType;
#[cfg(feature = "MTLLibrary")]
pub use self::__MTLLibrary::MTLVertexAttribute;
#[cfg(feature = "MTLLinkedFunctions")]
pub use self::__MTLLinkedFunctions::MTLLinkedFunctions;
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLParallelRenderCommandEncoder"
))]
pub use self::__MTLParallelRenderCommandEncoder::MTLParallelRenderCommandEncoder;
#[cfg(feature = "MTLPipeline")]
pub use self::__MTLPipeline::MTLMutability;
#[cfg(feature = "MTLPipeline")]
pub use self::__MTLPipeline::MTLPipelineBufferDescriptor;
#[cfg(feature = "MTLPipeline")]
pub use self::__MTLPipeline::MTLPipelineBufferDescriptorArray;
#[cfg(feature = "MTLPixelFormat")]
pub use self::__MTLPixelFormat::MTLPixelFormat;
#[cfg(feature = "MTLRasterizationRate")]
pub use self::__MTLRasterizationRate::MTLRasterizationRateLayerArray;
#[cfg(feature = "MTLRasterizationRate")]
pub use self::__MTLRasterizationRate::MTLRasterizationRateLayerDescriptor;
#[cfg(feature = "MTLRasterizationRate")]
pub use self::__MTLRasterizationRate::MTLRasterizationRateMap;
#[cfg(feature = "MTLRasterizationRate")]
pub use self::__MTLRasterizationRate::MTLRasterizationRateMapDescriptor;
#[cfg(feature = "MTLRasterizationRate")]
pub use self::__MTLRasterizationRate::MTLRasterizationRateSampleArray;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLCullMode;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLDepthClipMode;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLDrawIndexedPrimitivesIndirectArguments;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLDrawPatchIndirectArguments;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLDrawPrimitivesIndirectArguments;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLPrimitiveType;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLQuadTessellationFactorsHalf;
#[cfg(all(feature = "MTLCommandEncoder", feature = "MTLRenderCommandEncoder"))]
pub use self::__MTLRenderCommandEncoder::MTLRenderCommandEncoder;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLRenderStages;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLScissorRect;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLTriangleFillMode;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLTriangleTessellationFactorsHalf;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLVertexAmplificationViewMapping;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLViewport;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLVisibilityResultMode;
#[cfg(feature = "MTLRenderCommandEncoder")]
pub use self::__MTLRenderCommandEncoder::MTLWinding;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLClearColor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLLoadAction;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLMultisampleDepthResolveFilter;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLMultisampleStencilResolveFilter;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassAttachmentDescriptor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassColorAttachmentDescriptor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassColorAttachmentDescriptorArray;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassDepthAttachmentDescriptor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassDescriptor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassSampleBufferAttachmentDescriptor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassSampleBufferAttachmentDescriptorArray;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLRenderPassStencilAttachmentDescriptor;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLStoreAction;
#[cfg(feature = "MTLRenderPass")]
pub use self::__MTLRenderPass::MTLStoreActionOptions;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLBlendFactor;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLBlendOperation;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLColorWriteMask;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLMeshRenderPipelineDescriptor;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLPrimitiveTopologyClass;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLRenderPipelineColorAttachmentDescriptor;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLRenderPipelineColorAttachmentDescriptorArray;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLRenderPipelineDescriptor;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLRenderPipelineFunctionsDescriptor;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLRenderPipelineReflection;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLRenderPipelineState;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTessellationControlPointIndexType;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTessellationFactorFormat;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTessellationFactorStepFunction;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTessellationPartitionMode;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTileRenderPipelineColorAttachmentDescriptor;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTileRenderPipelineColorAttachmentDescriptorArray;
#[cfg(feature = "MTLRenderPipeline")]
pub use self::__MTLRenderPipeline::MTLTileRenderPipelineDescriptor;
#[cfg(feature = "MTLResource")]
pub use self::__MTLResource::MTLCPUCacheMode;
#[cfg(feature = "MTLResource")]
pub use self::__MTLResource::MTLHazardTrackingMode;
#[cfg(feature = "MTLResource")]
pub use self::__MTLResource::MTLPurgeableState;
#[cfg(feature = "MTLResource")]
pub use self::__MTLResource::MTLResource;
#[cfg(feature = "MTLResource")]
pub use self::__MTLResource::MTLResourceOptions;
#[cfg(feature = "MTLResource")]
pub use self::__MTLResource::MTLStorageMode;
#[cfg(feature = "MTLResourceStateCommandEncoder")]
pub use self::__MTLResourceStateCommandEncoder::MTLMapIndirectArguments;
#[cfg(all(
feature = "MTLCommandEncoder",
feature = "MTLResourceStateCommandEncoder"
))]
pub use self::__MTLResourceStateCommandEncoder::MTLResourceStateCommandEncoder;
#[cfg(feature = "MTLResourceStateCommandEncoder")]
pub use self::__MTLResourceStateCommandEncoder::MTLSparseTextureMappingMode;
#[cfg(feature = "MTLResourceStatePass")]
pub use self::__MTLResourceStatePass::MTLResourceStatePassDescriptor;
#[cfg(feature = "MTLResourceStatePass")]
pub use self::__MTLResourceStatePass::MTLResourceStatePassSampleBufferAttachmentDescriptor;
#[cfg(feature = "MTLResourceStatePass")]
pub use self::__MTLResourceStatePass::MTLResourceStatePassSampleBufferAttachmentDescriptorArray;
#[cfg(feature = "MTLSampler")]
pub use self::__MTLSampler::MTLSamplerAddressMode;
#[cfg(feature = "MTLSampler")]
pub use self::__MTLSampler::MTLSamplerBorderColor;
#[cfg(feature = "MTLSampler")]
pub use self::__MTLSampler::MTLSamplerDescriptor;
#[cfg(feature = "MTLSampler")]
pub use self::__MTLSampler::MTLSamplerMinMagFilter;
#[cfg(feature = "MTLSampler")]
pub use self::__MTLSampler::MTLSamplerMipFilter;
#[cfg(feature = "MTLSampler")]
pub use self::__MTLSampler::MTLSamplerState;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLAttributeDescriptor;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLAttributeDescriptorArray;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLAttributeFormat;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLBufferLayoutDescriptor;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLBufferLayoutDescriptorArray;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLIndexType;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLStageInputOutputDescriptor;
#[cfg(feature = "MTLStageInputOutputDescriptor")]
pub use self::__MTLStageInputOutputDescriptor::MTLStepFunction;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLSharedTextureHandle;
#[cfg(all(feature = "MTLResource", feature = "MTLTexture"))]
pub use self::__MTLTexture::MTLTexture;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLTextureCompressionType;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLTextureDescriptor;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLTextureSwizzle;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLTextureSwizzleChannels;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLTextureType;
#[cfg(feature = "MTLTexture")]
pub use self::__MTLTexture::MTLTextureUsage;
#[cfg(feature = "MTLTypes")]
pub use self::__MTLTypes::MTLCoordinate2D;
#[cfg(feature = "MTLTypes")]
pub use self::__MTLTypes::MTLOrigin;
#[cfg(feature = "MTLTypes")]
pub use self::__MTLTypes::MTLRegion;
#[cfg(feature = "MTLTypes")]
pub use self::__MTLTypes::MTLResourceID;
#[cfg(feature = "MTLTypes")]
pub use self::__MTLTypes::MTLSamplePosition;
#[cfg(feature = "MTLTypes")]
pub use self::__MTLTypes::MTLSize;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLBufferLayoutStrideDynamic;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexAttributeDescriptor;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexAttributeDescriptorArray;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexBufferLayoutDescriptor;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexBufferLayoutDescriptorArray;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexDescriptor;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexFormat;
#[cfg(feature = "MTLVertexDescriptor")]
pub use self::__MTLVertexDescriptor::MTLVertexStepFunction;
#[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
pub use self::__MTLVisibleFunctionTable::MTLVisibleFunctionTable;
#[cfg(feature = "MTLVisibleFunctionTable")]
pub use self::__MTLVisibleFunctionTable::MTLVisibleFunctionTableDescriptor;

82
vendor/objc2-metal/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,82 @@
//! # Bindings to the `Metal` framework
//!
//! See [Apple's docs][apple-doc] and [the general docs on framework crates][framework-crates] for more information.
//!
//! [apple-doc]: https://developer.apple.com/documentation/metal/
//! [framework-crates]: https://docs.rs/objc2/latest/objc2/topics/about_generated/index.html
//!
//! Metal has tools for validating that you're using it correctly, using these
//! is highly recommended! See [Apple's documentation on it][apple-doc], or
//! run `man MetalValidation` to get information on environment variables.
//!
//! [apple-doc]: https://developer.apple.com/documentation/xcode/validating-your-apps-metal-api-usage/.
//!
//! Note: To use `MTLCreateSystemDefaultDevice` you need to link to
//! `CoreGraphics`, this can be done by using `objc2-app-kit`, or by doing:
//! ```rust
//! #[link(name = "CoreGraphics", kind = "framework")]
//! extern "C" {}
//! ```
//!
//!
//! ## Example
//!
//! Drawing a rotating triangle.
//!
//! ```ignore
#![doc = include_str!("../examples/triangle.rs")]
//! ```
//!
//! With the following shader.
//!
//! ```ignore
#![doc = include_str!("../examples/triangle.metal")]
//! ```
#![recursion_limit = "256"]
#![allow(non_snake_case)]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/objc2-metal/0.2.2")]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
#[cfg(feature = "MTLCaptureManager")]
mod capture;
#[cfg(feature = "MTLCounters")]
mod counters;
#[cfg(feature = "MTLDevice")]
mod device;
mod generated;
#[cfg(feature = "MTLAccelerationStructureTypes")]
mod packed;
#[cfg(feature = "unstable-private")]
mod private;
#[cfg(feature = "MTLResource")]
mod resource;
mod slice;
#[cfg(feature = "MTLTexture")]
mod texture;
#[cfg(feature = "MTLCounters")]
pub use self::counters::*;
#[allow(unused_imports, unreachable_pub)]
pub use self::generated::*;
#[cfg(feature = "MTLAccelerationStructureTypes")]
pub use self::packed::MTLPackedFloat3;
#[cfg(feature = "unstable-private")]
pub use self::private::MTLDevicePrivate;
#[cfg(feature = "MTLResource")]
pub use self::resource::*;
#[cfg(all(feature = "MTLRenderCommandEncoder", feature = "MTLCommandEncoder"))]
pub use self::slice::MTLRenderCommandEncoderSliceExt;
#[cfg(feature = "MTLTexture")]
pub use self::texture::*;
// CoreFoundation
#[allow(dead_code)]
pub(crate) type CFTimeInterval = std::os::raw::c_double;

52
vendor/objc2-metal/src/packed.rs vendored Normal file
View File

@@ -0,0 +1,52 @@
use std::os::raw::c_float;
use objc2::encode::{Encode, Encoding, RefEncode};
// `MTLPackedFloat3` is actually a union internally, but replacing it with
// this simpler struct same semantics in Rust, and is generally the nicer
// pattern.
//
// <https://users.rust-lang.org/t/mapping-nested-packed-union-from-c-to-rust/87334>
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLPackedFloat3 {
pub x: c_float,
pub y: c_float,
pub z: c_float,
}
unsafe impl Encode for MTLPackedFloat3 {
const ENCODING: Encoding = Encoding::Struct(
"_MTLPackedFloat3",
&[Encoding::Union(
"?",
&[
Encoding::Struct(
"?",
&[c_float::ENCODING, c_float::ENCODING, c_float::ENCODING],
),
Encoding::Array(3, &c_float::ENCODING),
],
)],
);
}
unsafe impl RefEncode for MTLPackedFloat3 {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(test)]
mod tests {
use alloc::string::ToString;
use objc2::encode::Encode;
use crate::MTLPackedFloat4x3;
#[test]
fn test_packed_float() {
assert_eq!(
MTLPackedFloat4x3::ENCODING.to_string(),
"{_MTLPackedFloat4x3=[4{_MTLPackedFloat3=(?={?=fff}[3f])}]}",
);
}
}

69
vendor/objc2-metal/src/private.rs vendored Normal file
View File

@@ -0,0 +1,69 @@
//! Private functionality.
//!
//! The credit for finding these belong to the [metal-rs] project.
//!
//! [metal-rs]: https://github.com/gfx-rs/metal-rs
#![allow(clippy::missing_safety_doc)]
#![allow(unused_imports)]
use std::ffi::c_void;
use crate::*;
use objc2::rc::{Allocated, Retained};
use objc2::runtime::{AnyObject, ProtocolObject};
use objc2::{extern_methods, msg_send_id, Message};
pub unsafe trait MTLDevicePrivate: Message {
unsafe fn vendorName(&self) -> Retained<objc2_foundation::NSString> {
unsafe { msg_send_id![self, vendorName] }
}
unsafe fn familyName(&self) -> Retained<objc2_foundation::NSString> {
unsafe { msg_send_id![self, familyName] }
}
}
#[cfg(feature = "MTLDevice")]
unsafe impl<P: MTLDevice + Message> MTLDevicePrivate for P {}
extern_methods!(
#[cfg(feature = "MTLRenderPipeline")]
unsafe impl MTLRenderPipelineReflection {
#[cfg(feature = "MTLDevice")]
#[method_id(initWithVertexData:fragmentData:serializedVertexDescriptor:device:options:flags:)]
pub unsafe fn initWithVertexData(
this: Allocated<Self>,
vertex_data: *mut c_void,
fragment_data: *mut c_void,
vertex_desc: *mut c_void,
device: &ProtocolObject<dyn MTLDevice>,
options: u64,
flags: u64,
) -> Option<Retained<Self>>;
#[method_id(newSerializedVertexDataWithFlags:error:_)]
pub unsafe fn newSerializedVertexDataWithFlags_error(
&self,
flags: u64,
) -> Result<Retained<AnyObject>, Retained<objc2_foundation::NSError>>;
#[method(serializeFragmentData)]
pub unsafe fn serializeFragmentData(&self) -> *mut c_void;
}
);
extern_methods!(
#[cfg(feature = "MTLSamplerDescriptor")]
unsafe impl MTLSamplerDescriptor {
#[method(setLodBias:)]
pub unsafe fn setLodBias(&self, bias: f32);
}
);
extern_methods!(
#[cfg(feature = "MTLVertexDescriptor")]
unsafe impl MTLVertexDescriptor {
#[method_id(newSerializedDescriptor)]
pub unsafe fn newSerializedDescriptor(&self) -> Option<Retained<AnyObject>>;
}
);

11
vendor/objc2-metal/src/resource.rs vendored Normal file
View File

@@ -0,0 +1,11 @@
#![allow(non_upper_case_globals)]
use objc2::ffi::NSUInteger;
pub const MTLResourceCPUCacheModeShift: NSUInteger = 0;
pub const MTLResourceCPUCacheModeMask: NSUInteger = 0xf << MTLResourceCPUCacheModeShift;
pub const MTLResourceStorageModeShift: NSUInteger = 4;
pub const MTLResourceStorageModeMask: NSUInteger = 0xf << MTLResourceStorageModeShift;
pub const MTLResourceHazardTrackingModeShift: NSUInteger = 8;
pub const MTLResourceHazardTrackingModeMask: NSUInteger = 0x3 << MTLResourceHazardTrackingModeShift;

31
vendor/objc2-metal/src/slice.rs vendored Normal file
View File

@@ -0,0 +1,31 @@
#![allow(unused_imports)]
#![allow(clippy::missing_safety_doc)]
use std::ptr::NonNull;
use crate::*;
#[allow(dead_code)]
fn slice_to_ptr_count<T>(slice: &[T]) -> (NonNull<T>, usize) {
let ptr: *const T = slice.as_ptr();
let ptr: *mut T = ptr as *mut T;
// SAFETY: Slice pointers are always non-null
let ptr = unsafe { NonNull::new_unchecked(ptr) };
(ptr, slice.len())
}
#[cfg(all(feature = "MTLRenderCommandEncoder", feature = "MTLCommandEncoder"))]
pub trait MTLRenderCommandEncoderSliceExt: MTLRenderCommandEncoder + objc2::Message {
// TODO: Safety
unsafe fn setViewports(&self, viewports: &[MTLViewport]);
}
#[cfg(all(feature = "MTLRenderCommandEncoder", feature = "MTLCommandEncoder"))]
impl<P: MTLRenderCommandEncoder + objc2::Message> MTLRenderCommandEncoderSliceExt for P {
unsafe fn setViewports(&self, viewports: &[MTLViewport]) {
let (ptr, count) = slice_to_ptr_count(viewports);
unsafe { self.setViewports_count(ptr, count) }
}
}
// TODO: Many more methods take `(NonNull<Foo>, NSUInteger)` that can be
// turned into `&[Foo]`.

9
vendor/objc2-metal/src/texture.rs vendored Normal file
View File

@@ -0,0 +1,9 @@
#![allow(non_upper_case_globals)]
use crate::{MTLTextureSwizzle, MTLTextureSwizzleChannels};
pub const MTLTextureSwizzleChannelsDefault: MTLTextureSwizzleChannels = MTLTextureSwizzleChannels {
red: MTLTextureSwizzle::Red,
green: MTLTextureSwizzle::Green,
blue: MTLTextureSwizzle::Blue,
alpha: MTLTextureSwizzle::Alpha,
};