use crate::common::*;
use crate::Foundation::*;
use crate::Metal::*;
ns_enum!(
#[underlying(NSInteger)]
pub enum MTLIOPriority {
MTLIOPriorityHigh = 0,
MTLIOPriorityNormal = 1,
MTLIOPriorityLow = 2,
}
);
ns_enum!(
#[underlying(NSInteger)]
pub enum MTLIOCommandQueueType {
MTLIOCommandQueueTypeConcurrent = 0,
MTLIOCommandQueueTypeSerial = 1,
}
);
extern_static!(MTLIOErrorDomain: &'static NSErrorDomain);
ns_error_enum!(
#[underlying(NSInteger)]
pub enum MTLIOError {
MTLIOErrorURLInvalid = 1,
MTLIOErrorInternal = 2,
}
);
extern_protocol!(
pub unsafe trait MTLIOCommandQueue: NSObjectProtocol {
#[method(enqueueBarrier)]
unsafe fn enqueueBarrier(&self);
#[method_id(@__retain_semantics Other commandBuffer)]
unsafe fn commandBuffer(&self) -> Id<ProtocolObject<dyn MTLIOCommandBuffer>>;
#[method_id(@__retain_semantics Other commandBufferWithUnretainedReferences)]
unsafe fn commandBufferWithUnretainedReferences(
&self,
) -> Id<ProtocolObject<dyn MTLIOCommandBuffer>>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Id<NSString>>;
#[cfg(feature = "Foundation_NSString")]
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
}
unsafe impl ProtocolType for dyn MTLIOCommandQueue {}
);
extern_protocol!(
pub unsafe trait MTLIOScratchBuffer: NSObjectProtocol {
#[method_id(@__retain_semantics Other buffer)]
unsafe fn buffer(&self) -> Id<ProtocolObject<dyn MTLBuffer>>;
}
unsafe impl ProtocolType for dyn MTLIOScratchBuffer {}
);
extern_protocol!(
pub unsafe trait MTLIOScratchBufferAllocator: NSObjectProtocol {
#[method_id(@__retain_semantics New newScratchBufferWithMinimumSize:)]
unsafe fn newScratchBufferWithMinimumSize(
&self,
minimum_size: NSUInteger,
) -> Option<Id<ProtocolObject<dyn MTLIOScratchBuffer>>>;
}
unsafe impl ProtocolType for dyn MTLIOScratchBufferAllocator {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Metal_MTLIOCommandQueueDescriptor")]
pub struct MTLIOCommandQueueDescriptor;
#[cfg(feature = "Metal_MTLIOCommandQueueDescriptor")]
unsafe impl ClassType for MTLIOCommandQueueDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Metal_MTLIOCommandQueueDescriptor")]
unsafe impl NSCopying for MTLIOCommandQueueDescriptor {}
#[cfg(feature = "Metal_MTLIOCommandQueueDescriptor")]
unsafe impl NSObjectProtocol for MTLIOCommandQueueDescriptor {}
extern_methods!(
#[cfg(feature = "Metal_MTLIOCommandQueueDescriptor")]
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<Id<ProtocolObject<dyn MTLIOScratchBufferAllocator>>>;
#[method(setScratchBufferAllocator:)]
pub unsafe fn setScratchBufferAllocator(
&self,
scratch_buffer_allocator: Option<&ProtocolObject<dyn MTLIOScratchBufferAllocator>>,
);
}
);
extern_methods!(
#[cfg(feature = "Metal_MTLIOCommandQueueDescriptor")]
unsafe impl MTLIOCommandQueueDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_protocol!(
pub unsafe trait MTLIOFileHandle: NSObjectProtocol {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other label)]
unsafe fn label(&self) -> Option<Id<NSString>>;
#[cfg(feature = "Foundation_NSString")]
#[method(setLabel:)]
unsafe fn setLabel(&self, label: Option<&NSString>);
}
unsafe impl ProtocolType for dyn MTLIOFileHandle {}
);