pub struct CommandBuffer(/* private fields */);Expand description
MTL4 command buffer for recording GPU commands.
C++ equivalent: MTL4::CommandBuffer
CommandBuffer in Metal 4 provides explicit control over command recording with an allocator-based memory model.
Implementations§
Source§impl CommandBuffer
impl CommandBuffer
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create a CommandBuffer from a raw pointer.
Sourcepub fn device(&self) -> Option<Device>
pub fn device(&self) -> Option<Device>
Get the device.
C++ equivalent: MTL::Device* device() const
Sourcepub fn set_label(&self, label: &str)
pub fn set_label(&self, label: &str)
Set the label.
C++ equivalent: void setLabel(const NS::String* label)
Sourcepub fn begin_command_buffer(&self, allocator: &CommandAllocator)
pub fn begin_command_buffer(&self, allocator: &CommandAllocator)
Begin recording commands with an allocator.
C++ equivalent: void beginCommandBuffer(const MTL4::CommandAllocator* allocator)
Sourcepub fn begin_command_buffer_with_options(
&self,
allocator: &CommandAllocator,
options: &CommandBufferOptions,
)
pub fn begin_command_buffer_with_options( &self, allocator: &CommandAllocator, options: &CommandBufferOptions, )
Begin recording commands with an allocator and options.
C++ equivalent: void beginCommandBuffer(const MTL4::CommandAllocator*, const MTL4::CommandBufferOptions*)
Sourcepub fn end_command_buffer(&self)
pub fn end_command_buffer(&self)
End recording commands.
C++ equivalent: void endCommandBuffer()
Sourcepub fn use_residency_set(&self, residency_set: &ResidencySet)
pub fn use_residency_set(&self, residency_set: &ResidencySet)
Use a residency set.
C++ equivalent: void useResidencySet(const MTL::ResidencySet* residencySet)
Sourcepub fn use_residency_sets(&self, residency_sets: &[&ResidencySet])
pub fn use_residency_sets(&self, residency_sets: &[&ResidencySet])
Use multiple residency sets.
C++ equivalent: void useResidencySets(const MTL::ResidencySet* const[], NS::UInteger count)
Sourcepub fn push_debug_group(&self, name: &str)
pub fn push_debug_group(&self, name: &str)
Push a debug group.
C++ equivalent: void pushDebugGroup(const NS::String* string)
Sourcepub fn pop_debug_group(&self)
pub fn pop_debug_group(&self)
Pop the current debug group.
C++ equivalent: void popDebugGroup()
Sourcepub fn compute_command_encoder(&self) -> Option<ComputeCommandEncoder>
pub fn compute_command_encoder(&self) -> Option<ComputeCommandEncoder>
Create a compute command encoder.
C++ equivalent: ComputeCommandEncoder* computeCommandEncoder()
Sourcepub fn render_command_encoder(
&self,
descriptor: &RenderPassDescriptor,
) -> Option<RenderCommandEncoder>
pub fn render_command_encoder( &self, descriptor: &RenderPassDescriptor, ) -> Option<RenderCommandEncoder>
Create a render command encoder with the specified render pass descriptor.
C++ equivalent: RenderCommandEncoder* renderCommandEncoder(const RenderPassDescriptor*)
Sourcepub fn machine_learning_command_encoder(
&self,
) -> Option<MachineLearningCommandEncoder>
pub fn machine_learning_command_encoder( &self, ) -> Option<MachineLearningCommandEncoder>
Create a machine learning command encoder.
C++ equivalent: MachineLearningCommandEncoder* machineLearningCommandEncoder()
Sourcepub fn resolve_counter_heap(
&self,
counter_heap: *const c_void,
range_location: UInteger,
range_length: UInteger,
buffer_range: BufferRange,
fence_to_wait: *const c_void,
fence_to_update: *const c_void,
)
pub fn resolve_counter_heap( &self, counter_heap: *const c_void, range_location: UInteger, range_length: UInteger, buffer_range: BufferRange, fence_to_wait: *const c_void, fence_to_update: *const c_void, )
Resolve counter heap data into a buffer.
C++ equivalent: void resolveCounterHeap(const MTL4::CounterHeap*, NS::Range, const MTL4::BufferRange, const MTL::Fence*, const MTL::Fence*)
Sourcepub fn write_timestamp_into_heap(
&self,
counter_heap: *const c_void,
index: UInteger,
)
pub fn write_timestamp_into_heap( &self, counter_heap: *const c_void, index: UInteger, )
Write a timestamp into a counter heap.
C++ equivalent: void writeTimestampIntoHeap(const MTL4::CounterHeap*, NS::UInteger)