pub struct CommandQueue(/* private fields */);Expand description
A queue that organizes the order of command buffer execution.
C++ equivalent: MTL::CommandQueue
You typically create a command queue early in your app’s lifecycle and reuse it throughout the app. Command buffers created from the same queue are guaranteed to execute in the order they are committed.
Implementations§
Source§impl CommandQueue
impl CommandQueue
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create a CommandQueue from a raw pointer.
§Safety
The pointer must be a valid Metal command queue object.
Sourcepub fn command_buffer(&self) -> Option<CommandBuffer>
pub fn command_buffer(&self) -> Option<CommandBuffer>
Create a new command buffer.
C++ equivalent: CommandBuffer* commandBuffer()
Sourcepub fn command_buffer_with_unretained_references(&self) -> Option<CommandBuffer>
pub fn command_buffer_with_unretained_references(&self) -> Option<CommandBuffer>
Create a new command buffer with an unretained reference.
The returned command buffer is autoreleased and will be deallocated unless you explicitly retain it.
C++ equivalent: CommandBuffer* commandBufferWithUnretainedReferences()
Sourcepub unsafe fn command_buffer_with_descriptor_ptr(
&self,
descriptor: *const c_void,
) -> Option<CommandBuffer>
pub unsafe fn command_buffer_with_descriptor_ptr( &self, descriptor: *const c_void, ) -> Option<CommandBuffer>
Create a new command buffer with a descriptor (raw pointer version).
C++ equivalent: CommandBuffer* commandBuffer(const CommandBufferDescriptor*)
§Safety
The descriptor pointer must be valid.
Sourcepub fn command_buffer_with_descriptor(
&self,
descriptor: &CommandBufferDescriptor,
) -> Option<CommandBuffer>
pub fn command_buffer_with_descriptor( &self, descriptor: &CommandBufferDescriptor, ) -> Option<CommandBuffer>
Create a new command buffer with a typed descriptor.
C++ equivalent: CommandBuffer* commandBuffer(const CommandBufferDescriptor*)
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Get the label for this command queue.
C++ equivalent: NS::String* label() const
Sourcepub fn set_label(&self, label: &str)
pub fn set_label(&self, label: &str)
Set the label for this command queue.
C++ equivalent: void setLabel(const NS::String*)
Sourcepub fn device(&self) -> Device
pub fn device(&self) -> Device
Get the device that created this command queue.
C++ equivalent: Device* device() const
Sourcepub fn insert_debug_capture_boundary(&self)
pub fn insert_debug_capture_boundary(&self)
Insert a debug capture boundary.
C++ equivalent: void insertDebugCaptureBoundary()
Sourcepub unsafe fn add_residency_set(&self, residency_set: *const c_void)
pub unsafe fn add_residency_set(&self, residency_set: *const c_void)
Add a residency set to the command queue.
C++ equivalent: void addResidencySet(const ResidencySet*)
§Safety
The residency_set pointer must be valid.
Sourcepub unsafe fn add_residency_sets(
&self,
residency_sets: *const *const c_void,
count: UInteger,
)
pub unsafe fn add_residency_sets( &self, residency_sets: *const *const c_void, count: UInteger, )
Add multiple residency sets to the command queue.
C++ equivalent: void addResidencySets(const ResidencySet* const*, NS::UInteger count)
§Safety
The residency_sets pointer must be valid and point to count valid pointers.
Sourcepub unsafe fn remove_residency_set(&self, residency_set: *const c_void)
pub unsafe fn remove_residency_set(&self, residency_set: *const c_void)
Remove a residency set from the command queue.
C++ equivalent: void removeResidencySet(const ResidencySet*)
§Safety
The residency_set pointer must be valid.
Sourcepub unsafe fn remove_residency_sets(
&self,
residency_sets: *const *const c_void,
count: UInteger,
)
pub unsafe fn remove_residency_sets( &self, residency_sets: *const *const c_void, count: UInteger, )
Remove multiple residency sets from the command queue.
C++ equivalent: void removeResidencySets(const ResidencySet* const*, NS::UInteger count)
§Safety
The residency_sets pointer must be valid and point to count valid pointers.
Sourcepub fn wait_for_event(&self, event: &Event, value: u64)
pub fn wait_for_event(&self, event: &Event, value: u64)
Wait for an event to reach a specific value.
C++ equivalent: void wait(const MTL::Event* event, uint64_t value)
Sourcepub unsafe fn wait_for_drawable(&self, drawable: *const c_void)
pub unsafe fn wait_for_drawable(&self, drawable: *const c_void)
Wait for a drawable to become available.
C++ equivalent: void wait(const MTL::Drawable* drawable)
§Safety
The drawable pointer must be valid.