pub unsafe trait MTL4CommandQueue:
NSObjectProtocol
+ Send
+ Sync {
Show 16 methods
// Provided methods
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>
where Self: Sized + Message { ... }
fn label(&self) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
unsafe fn commit_count(
&self,
command_buffers: NonNull<NonNull<ProtocolObject<dyn MTL4CommandBuffer>>>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn commit_count_options(
&self,
command_buffers: NonNull<NonNull<ProtocolObject<dyn MTL4CommandBuffer>>>,
count: NSUInteger,
options: &MTL4CommitOptions,
)
where Self: Sized + Message { ... }
fn signalEvent_value(
&self,
event: &ProtocolObject<dyn MTLEvent>,
value: u64,
)
where Self: Sized + Message { ... }
fn waitForEvent_value(
&self,
event: &ProtocolObject<dyn MTLEvent>,
value: u64,
)
where Self: Sized + Message { ... }
fn signalDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>)
where Self: Sized + Message { ... }
fn waitForDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>)
where Self: Sized + Message { ... }
fn addResidencySet(
&self,
residency_set: &ProtocolObject<dyn MTLResidencySet>,
)
where Self: Sized + Message { ... }
unsafe fn addResidencySets_count(
&self,
residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
fn removeResidencySet(
&self,
residency_set: &ProtocolObject<dyn MTLResidencySet>,
)
where Self: Sized + Message { ... }
unsafe fn removeResidencySets_count(
&self,
residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn updateTextureMappings_heap_operations_count(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
heap: Option<&ProtocolObject<dyn MTLHeap>>,
operations: NonNull<MTL4UpdateSparseTextureMappingOperation>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn copyTextureMappingsFromTexture_toTexture_operations_count(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
destination_texture: &ProtocolObject<dyn MTLTexture>,
operations: NonNull<MTL4CopySparseTextureMappingOperation>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn updateBufferMappings_heap_operations_count(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
heap: Option<&ProtocolObject<dyn MTLHeap>>,
operations: NonNull<MTL4UpdateSparseBufferMappingOperation>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn copyBufferMappingsFromBuffer_toBuffer_operations_count(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
operations: NonNull<MTL4CopySparseBufferMappingOperation>,
count: NSUInteger,
)
where Self: Sized + Message { ... }
}MTL4CommandQueue only.Expand description
An abstraction representing a command queue that you use commit and synchronize command buffers and to perform other GPU operations.
See also Apple’s documentation
Provided Methods§
Sourcefn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>
Available on crate feature MTLDevice only.
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>
MTLDevice only.Returns the GPU device that the command queue belongs to.
Sourcefn label(&self) -> Option<Retained<NSString>>
fn label(&self) -> Option<Retained<NSString>>
Obtains this queue’s optional label for debugging purposes.
Sourceunsafe fn commit_count(
&self,
command_buffers: NonNull<NonNull<ProtocolObject<dyn MTL4CommandBuffer>>>,
count: NSUInteger,
)
Available on crate feature MTL4CommandBuffer only.
unsafe fn commit_count( &self, command_buffers: NonNull<NonNull<ProtocolObject<dyn MTL4CommandBuffer>>>, count: NSUInteger, )
MTL4CommandBuffer only.Enqueues an array of command buffers for execution.
The order in which you sort the command buffers in the array is meaningful, especially when it contains suspending/resuming
render passes. A suspending/resuming render pass is a render pass you create by calling
MTL4CommandBuffer/renderCommandEncoderWithDescriptor:options:,
and provide MTL4RenderEncoderOptionSuspending or MTL4RenderEncoderOptionResuming for the options parameter.
If your command buffers contain suspend/resume render passes, ensure that the first command buffer only suspends, and the last one only resumes. Additionally, make sure that all intermediate command buffers are both suspending and resuming.
- Parameters:
- commandBuffers: an array of
MTL4CommandBuffer. - count: the number of
MTL4CommandBufferinstances in thecommandBuffersarray.
§Safety
command_buffersmust be a valid pointer.countmight not be bounds-checked.
Sourceunsafe fn commit_count_options(
&self,
command_buffers: NonNull<NonNull<ProtocolObject<dyn MTL4CommandBuffer>>>,
count: NSUInteger,
options: &MTL4CommitOptions,
)
Available on crate feature MTL4CommandBuffer only.
unsafe fn commit_count_options( &self, command_buffers: NonNull<NonNull<ProtocolObject<dyn MTL4CommandBuffer>>>, count: NSUInteger, options: &MTL4CommitOptions, )
MTL4CommandBuffer only.Enqueues an array of command buffer instances for execution with a set of options.
Provide an MTL4CommitOptions instance to configure the commit operation.
The order in which you sort the command buffers in the array is meaningful, especially when it contains suspending/resuming
render passes. A suspending/resuming render pass is a render pass you create by calling
MTL4CommandBuffer/renderCommandEncoderWithDescriptor:options:,
and provide MTL4RenderEncoderOptionSuspending or MTL4RenderEncoderOptionResuming for the options parameter.
If your command buffers contain suspend/resume render passes, ensure that the first command buffer only suspends, and the last one only resumes. Additionally, make sure that all intermediate command buffers are both suspending and resuming.
When you commit work from multiple threads, modifying and reusing the same options instance, you are responsible for externally synchronizing access to it.
- Parameters:
- commandBuffers: an array of
MTL4CommandBuffer. - count: the number of
MTL4CommandBufferinstances in thecommandBuffersarray. - options: an instance of
MTL4CommitOptionsthat configures the commit operation.
§Safety
command_buffersmust be a valid pointer.countmight not be bounds-checked.
Sourcefn signalEvent_value(&self, event: &ProtocolObject<dyn MTLEvent>, value: u64)
Available on crate feature MTLEvent only.
fn signalEvent_value(&self, event: &ProtocolObject<dyn MTLEvent>, value: u64)
MTLEvent only.Schedules an operation to signal a GPU event with a specific value after all GPU work prior to this point is complete.
- Parameters:
- event:
MTLEventto signal. - value: the value to signal the
MTLEventwith.
Sourcefn waitForEvent_value(&self, event: &ProtocolObject<dyn MTLEvent>, value: u64)
Available on crate feature MTLEvent only.
fn waitForEvent_value(&self, event: &ProtocolObject<dyn MTLEvent>, value: u64)
MTLEvent only.Schedules an operation to wait for a GPU event of a specific value before continuing to execute any future GPU work.
- Parameters:
- event:
MTLEventto wait on. - value: the specific value to wait for.
Sourcefn signalDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>)
Available on crate feature MTLDrawable only.
fn signalDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>)
MTLDrawable only.Schedules a signal operation on the command queue to indicate when rendering to a Metal drawable is complete.
Signaling when rendering to a MTLDrawable instance is complete indicates that it’s safe to present it to the
display.
You are responsible for calling this method after committing all command buffers that contain commands targeting
this drawable, and before calling MTLDrawable/present, MTLDrawable/presentAtTime:, or
MTLDrawable/presentAfterMinimumDuration:.
- Note: This method doesn’t trigger the presentation of the drawable, and fails if you call it after any of the present methods, or if you call it multiple times.
Metal doesn’t guarantee that command buffers you commit to the command queue after calling this method execute before presentation.
- Parameters:
- drawable:
MTLDrawableinstance to signal.
Sourcefn waitForDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>)
Available on crate feature MTLDrawable only.
fn waitForDrawable(&self, drawable: &ProtocolObject<dyn MTLDrawable>)
MTLDrawable only.Schedules a wait operation on the command queue to ensure the display is no longer using a specific Metal drawable.
Use this method to ensure the display is no longer using a MTLDrawable instance before executing any subsequent
commands.
This method returns immediately and doesn’t perform any synchronization on the current thread. You are responsible for calling this method before committing any command buffers containing commands that target this drawable.
Call this method multiple times if you commit your command buffers to multiple command queues.
- Parameters:
- drawable:
MTLDrawableinstance to signal.
Sourcefn addResidencySet(&self, residency_set: &ProtocolObject<dyn MTLResidencySet>)
Available on crate feature MTLResidencySet only.
fn addResidencySet(&self, residency_set: &ProtocolObject<dyn MTLResidencySet>)
MTLResidencySet only.Marks a residency set as part of this command queue.
Ensures that Metal makes the residency set resident during the execution of all command buffers you commit to this command queue.
Each command queue supports up to 32 unique residency set instances.
- Parameter residencySet:
MTLResidencySetto add to the command queue.
Sourceunsafe fn addResidencySets_count(
&self,
residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>,
count: NSUInteger,
)
Available on crate feature MTLResidencySet only.
unsafe fn addResidencySets_count( &self, residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>, count: NSUInteger, )
MTLResidencySet only.Marks an array of residency sets as part of this command queue.
Ensures that Metal makes the residency set resident during the execution of all command buffers you commit to this command queue.
Each command queue supports up to 32 unique residency set instances.
- Parameters:
- residencySets: Array of
MTLResidencySetinstances to add to the command queue. - count: Number of
MTLResidencySetinstances in the array.
§Safety
residency_setsmust be a valid pointer.countmight not be bounds-checked.
Sourcefn removeResidencySet(
&self,
residency_set: &ProtocolObject<dyn MTLResidencySet>,
)
Available on crate feature MTLResidencySet only.
fn removeResidencySet( &self, residency_set: &ProtocolObject<dyn MTLResidencySet>, )
MTLResidencySet only.Removes a residency set from the command queue.
After calling this method ensures only the remaining residency sets remain resident during the execution of the command buffers you commit this command queue.
- Parameter residencySet:
MTLResidencySetinstance to remove from the command queue.
Sourceunsafe fn removeResidencySets_count(
&self,
residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>,
count: NSUInteger,
)
Available on crate feature MTLResidencySet only.
unsafe fn removeResidencySets_count( &self, residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>, count: NSUInteger, )
MTLResidencySet only.Removes multiple residency sets from the command queue.
After calling this method ensures only the remaining residency sets remain resident during the execution of the command buffers you commit this command queue.
- Parameters:
- residencySets: Array of
MTLResidencySetinstances to remove from the command queue. - count: Number of
MTLResidencySetinstances in the array.
§Safety
residency_setsmust be a valid pointer.countmight not be bounds-checked.
Sourceunsafe fn updateTextureMappings_heap_operations_count(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
heap: Option<&ProtocolObject<dyn MTLHeap>>,
operations: NonNull<MTL4UpdateSparseTextureMappingOperation>,
count: NSUInteger,
)
Available on crate features MTLAllocation and MTLHeap and MTLResource and MTLResourceStateCommandEncoder and MTLTexture and MTLTypes only.
unsafe fn updateTextureMappings_heap_operations_count( &self, texture: &ProtocolObject<dyn MTLTexture>, heap: Option<&ProtocolObject<dyn MTLHeap>>, operations: NonNull<MTL4UpdateSparseTextureMappingOperation>, count: NSUInteger, )
MTLAllocation and MTLHeap and MTLResource and MTLResourceStateCommandEncoder and MTLTexture and MTLTypes only.Updates multiple regions within a placement sparse texture to alias specific tiles of a Metal heap.
You can provide a nil parameter to the heap argument only if when you perform unmap operations. Otherwise, you are
responsible for ensuring the heap is non-nil and has a
MTLHeapDescriptor/maxCompatiblePlacementSparsePageSize of at least the texture’s
MTLTextureDescriptor/placementSparsePageSize.
When performing a sparse mapping update, you are responsible for issuing a barrier against stage MTLStageResourceState.
You can determine the sparse texture tier by calling MTLTexture/sparseTextureTier.
- Parameters:
- texture: A placement sparse
MTLTexture. - heap:
MTLHeapyou allocate with typeMTLHeapType/MTLHeapTypePlacement. - operations: An array of
MTL4UpdateSparseTextureMappingOperationinstances to perform. - count: Number of operations to perform.
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.operationsmust be a valid pointer.countmight not be bounds-checked.
Sourceunsafe fn copyTextureMappingsFromTexture_toTexture_operations_count(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
destination_texture: &ProtocolObject<dyn MTLTexture>,
operations: NonNull<MTL4CopySparseTextureMappingOperation>,
count: NSUInteger,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture and MTLTypes only.
unsafe fn copyTextureMappingsFromTexture_toTexture_operations_count( &self, source_texture: &ProtocolObject<dyn MTLTexture>, destination_texture: &ProtocolObject<dyn MTLTexture>, operations: NonNull<MTL4CopySparseTextureMappingOperation>, count: NSUInteger, )
MTLAllocation and MTLResource and MTLTexture and MTLTypes only.Copies multiple regions within a source placement sparse texture to a destination placement sparse texture.
You are responsible for ensuring the source and destination textures have the same
MTLTextureDescriptor/placementSparsePageSize.
Additionally, you are responsible for ensuring that the source and destination textures don’t use the same aliased tiles at the same time.
-
Note: If a sparse texture and a sparse buffer share the same backing tiles, these don’t provide you you with meaningful views of the other resource’s data.
-
Parameters:
-
sourceTexture: The source placement sparse
MTLTexture. -
destinationTexture: The destination placement sparse
MTLTexture. -
operations: An array of
MTL4CopySparseTextureMappingOperationinstances to perform. -
count: Number of operations to perform.
§Safety
source_texturemay need to be synchronized.source_texturemay be unretained, you must ensure it is kept alive while in use.destination_texturemay need to be synchronized.destination_texturemay be unretained, you must ensure it is kept alive while in use.operationsmust be a valid pointer.countmight not be bounds-checked.
Sourceunsafe fn updateBufferMappings_heap_operations_count(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
heap: Option<&ProtocolObject<dyn MTLHeap>>,
operations: NonNull<MTL4UpdateSparseBufferMappingOperation>,
count: NSUInteger,
)
Available on crate features MTLAllocation and MTLBuffer and MTLHeap and MTLResource and MTLResourceStateCommandEncoder only.
unsafe fn updateBufferMappings_heap_operations_count( &self, buffer: &ProtocolObject<dyn MTLBuffer>, heap: Option<&ProtocolObject<dyn MTLHeap>>, operations: NonNull<MTL4UpdateSparseBufferMappingOperation>, count: NSUInteger, )
MTLAllocation and MTLBuffer and MTLHeap and MTLResource and MTLResourceStateCommandEncoder only.Updates multiple regions within a placement sparse buffer to alias specific tiles from a Metal heap.
You can provide a nil parameter to the heap argument only when you perform unmap operations. Otherwise, you are
responsible for ensuring parameter heap references an MTLHeap that has a MTLHeapDescriptor/maxCompatiblePlacementSparsePageSize
of at least the buffer’s placementSparsePageSize you assign when creating the sparse buffer via
MTLDevice/newBufferWithLength:options:placementSparsePageSize:.
- Parameters:
- buffer: A placement sparse
MTLBuffer. - heap: An
MTLHeapyou allocate with typeMTLHeapType/MTLHeapTypePlacement. - operations: An array of
MTL4UpdateSparseBufferMappingOperationinstances to perform. - count: Number of operations to perform.
§Safety
buffermay need to be synchronized.buffermay be unretained, you must ensure it is kept alive while in use.buffercontents should be of the correct type.operationsmust be a valid pointer.countmight not be bounds-checked.
Sourceunsafe fn copyBufferMappingsFromBuffer_toBuffer_operations_count(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
operations: NonNull<MTL4CopySparseBufferMappingOperation>,
count: NSUInteger,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource only.
unsafe fn copyBufferMappingsFromBuffer_toBuffer_operations_count( &self, source_buffer: &ProtocolObject<dyn MTLBuffer>, destination_buffer: &ProtocolObject<dyn MTLBuffer>, operations: NonNull<MTL4CopySparseBufferMappingOperation>, count: NSUInteger, )
MTLAllocation and MTLBuffer and MTLResource only.Copies multiple offsets within a source placement sparse buffer to a destination placement sparse buffer.
You are responsible for ensuring the source destination sparse buffers have the same placementSparsePageSize when
you create them via MTLDevice/newBufferWithLength:options:placementSparsePageSize:.
Additionally, you are responsible for ensuring both the source and destination sparse buffers don’t use the same aliased tiles at the same time.
-
Note: If a sparse texture and a sparse buffer share the same backing tiles, these don’t provide you with meaningful views of the other resource’s data.
-
Parameters:
-
sourceBuffer: The source placement sparse
MTLBuffer. -
destinationBuffer: The destination placement sparse
MTLBuffer. -
operations: An array of
MTL4CopySparseBufferMappingOperationinstances to perform. -
count: Number of operations to perform.
§Safety
source_buffermay need to be synchronized.source_buffermay be unretained, you must ensure it is kept alive while in use.source_buffercontents should be of the correct type.destination_buffermay need to be synchronized.destination_buffermay be unretained, you must ensure it is kept alive while in use.destination_buffercontents should be of the correct type.operationsmust be a valid pointer.countmight not be bounds-checked.