use objc2::{
extern_class, extern_conformance, extern_methods,
rc::{Allocated, Retained},
runtime::{NSObject, ProtocolObject},
};
use objc2_foundation::{CopyingHelper, NSCopying, NSObjectProtocol};
use crate::{MTLIOCommandQueueType, MTLIOPriority, MTLIOScratchBufferAllocator};
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLIOCommandQueueDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLIOCommandQueueDescriptor {}
);
unsafe impl CopyingHelper for MTLIOCommandQueueDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLIOCommandQueueDescriptor {}
);
impl MTLIOCommandQueueDescriptor {
extern_methods!(
#[unsafe(method(maxCommandBufferCount))]
#[unsafe(method_family = none)]
pub fn max_command_buffer_count(&self) -> usize;
#[unsafe(method(setMaxCommandBufferCount:))]
#[unsafe(method_family = none)]
pub fn set_max_command_buffer_count(
&self,
count: usize,
);
#[unsafe(method(priority))]
#[unsafe(method_family = none)]
pub fn priority(&self) -> MTLIOPriority;
#[unsafe(method(setPriority:))]
#[unsafe(method_family = none)]
pub fn set_priority(
&self,
priority: MTLIOPriority,
);
#[unsafe(method(r#type))]
#[unsafe(method_family = none)]
pub fn queue_type(&self) -> MTLIOCommandQueueType;
#[unsafe(method(setType:))]
#[unsafe(method_family = none)]
pub fn set_queue_type(
&self,
t: MTLIOCommandQueueType,
);
#[unsafe(method(maxCommandsInFlight))]
#[unsafe(method_family = none)]
pub fn max_commands_in_flight(&self) -> usize;
#[unsafe(method(setMaxCommandsInFlight:))]
#[unsafe(method_family = none)]
pub fn set_max_commands_in_flight(
&self,
count: usize,
);
#[unsafe(method(scratchBufferAllocator))]
#[unsafe(method_family = none)]
pub fn scratch_buffer_allocator(&self) -> Option<Retained<ProtocolObject<dyn MTLIOScratchBufferAllocator>>>;
#[unsafe(method(setScratchBufferAllocator:))]
#[unsafe(method_family = none)]
pub fn set_scratch_buffer_allocator(
&self,
allocator: Option<&ProtocolObject<dyn MTLIOScratchBufferAllocator>>,
);
);
}
impl MTLIOCommandQueueDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}