Skip to main content

ComputeCommandEncoder

Struct ComputeCommandEncoder 

Source
pub struct ComputeCommandEncoder(/* private fields */);
Expand description

MTL4 compute command encoder.

C++ equivalent: MTL4::ComputeCommandEncoder

ComputeCommandEncoder encodes compute dispatch commands and resource bindings.

Implementations§

Source§

impl ComputeCommandEncoder

Source

pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>

Create a ComputeCommandEncoder from a raw pointer.

Source

pub fn as_raw(&self) -> *mut c_void

Get the raw pointer.

Source

pub fn device(&self) -> Option<Device>

Get the device.

C++ equivalent: MTL::Device* device() const

Source

pub fn label(&self) -> Option<String>

Get the label.

C++ equivalent: NS::String* label() const

Source

pub fn set_label(&self, label: &str)

Set the label.

C++ equivalent: void setLabel(const NS::String*)

Source

pub fn set_compute_pipeline_state(&self, pipeline: &ComputePipelineState)

Set the compute pipeline state.

C++ equivalent: void setComputePipelineState(const MTL::ComputePipelineState*)

Source

pub fn set_argument_table(&self, table: *const c_void, index: UInteger)

Set the argument table at index.

C++ equivalent: void setArgumentTable(const MTL4::ArgumentTable*, NS::UInteger)

Source

pub fn set_buffer( &self, buffer: *const c_void, offset: UInteger, index: UInteger, )

Set a buffer at index with offset.

C++ equivalent: void setBuffer(const MTL::Buffer*, NS::UInteger, NS::UInteger)

Source

pub fn set_buffers( &self, buffers: *const *const c_void, offsets: *const UInteger, range_location: UInteger, range_length: UInteger, )

Set multiple buffers.

C++ equivalent: void setBuffers(const MTL::Buffer* const*, const NS::UInteger*, NS::Range)

Source

pub fn set_bytes(&self, bytes: *const c_void, length: UInteger, index: UInteger)

Set bytes at index.

C++ equivalent: void setBytes(const void*, NS::UInteger, NS::UInteger)

Source

pub fn set_texture(&self, texture: *const c_void, index: UInteger)

Set a texture at index.

C++ equivalent: void setTexture(const MTL::Texture*, NS::UInteger)

Source

pub fn set_textures( &self, textures: *const *const c_void, range_location: UInteger, range_length: UInteger, )

Set multiple textures.

C++ equivalent: void setTextures(const MTL::Texture* const*, NS::Range)

Source

pub fn set_sampler_state(&self, sampler: *const c_void, index: UInteger)

Set a sampler state at index.

C++ equivalent: void setSamplerState(const MTL::SamplerState*, NS::UInteger)

Source

pub fn set_sampler_state_with_lod( &self, sampler: *const c_void, lod_min_clamp: f32, lod_max_clamp: f32, index: UInteger, )

Set a sampler state with LOD clamp.

C++ equivalent: void setSamplerState(const MTL::SamplerState*, float, float, NS::UInteger)

Source

pub fn set_threadgroup_memory_length(&self, length: UInteger, index: UInteger)

Set threadgroup memory length at index.

C++ equivalent: void setThreadgroupMemoryLength(NS::UInteger, NS::UInteger)

Source

pub fn dispatch_threadgroups( &self, threadgroups_per_grid: Size, threads_per_threadgroup: Size, )

Dispatch threadgroups.

C++ equivalent: void dispatchThreadgroups(MTL::Size, MTL::Size)

Source

pub fn dispatch_threads( &self, threads_per_grid: Size, threads_per_threadgroup: Size, )

Dispatch threads.

C++ equivalent: void dispatchThreads(MTL::Size, MTL::Size)

Source

pub fn dispatch_threadgroups_indirect( &self, indirect_buffer: *const c_void, indirect_buffer_offset: UInteger, threads_per_threadgroup: Size, )

Dispatch threadgroups with indirect buffer.

C++ equivalent: void dispatchThreadgroups(const MTL::Buffer*, NS::UInteger, MTL::Size)

Source

pub fn dispatch_threads_indirect( &self, indirect_buffer: *const c_void, indirect_buffer_offset: UInteger, threads_per_threadgroup: Size, )

Dispatch threads with indirect buffer.

C++ equivalent: void dispatchThreads(const MTL::Buffer*, NS::UInteger, MTL::Size)

Source

pub fn barrier(&self)

Insert a barrier.

C++ equivalent: void barrier()

Source

pub fn barrier_buffer( &self, buffer: *const c_void, visibility: VisibilityOptions, )

Insert a barrier for a buffer.

C++ equivalent: void barrier(const MTL::Buffer*, MTL4::VisibilityOptions)

Source

pub fn barrier_texture( &self, texture: *const c_void, visibility: VisibilityOptions, )

Insert a barrier for a texture.

C++ equivalent: void barrier(const MTL::Texture*, MTL4::VisibilityOptions)

Source

pub fn update_fence(&self, fence: *const c_void)

Update a fence.

C++ equivalent: void updateFence(const MTL::Fence*)

Source

pub fn wait_for_fence(&self, fence: *const c_void)

Wait for a fence.

C++ equivalent: void waitForFence(const MTL::Fence*)

Source

pub fn use_resource(&self, resource: *const c_void, usage: UInteger)

Use resource with usage.

C++ equivalent: void useResource(const MTL::Resource*, MTL::ResourceUsage)

Source

pub fn use_resources( &self, resources: *const *const c_void, count: UInteger, usage: UInteger, )

Use multiple resources.

C++ equivalent: void useResources(const MTL::Resource* const*, NS::UInteger, MTL::ResourceUsage)

Source

pub fn use_heap(&self, heap: *const c_void, usage: UInteger)

Use heap with usage.

C++ equivalent: void useHeap(const MTL::Heap*, MTL::ResourceUsage)

Source

pub fn use_heaps( &self, heaps: *const *const c_void, count: UInteger, usage: UInteger, )

Use multiple heaps.

C++ equivalent: void useHeaps(const MTL::Heap* const*, NS::UInteger, MTL::ResourceUsage)

Source

pub fn push_debug_group(&self, name: &str)

Push a debug group.

C++ equivalent: void pushDebugGroup(const NS::String*)

Source

pub fn pop_debug_group(&self)

Pop a debug group.

C++ equivalent: void popDebugGroup()

Source

pub fn insert_debug_signpost(&self, name: &str)

Insert a debug signpost.

C++ equivalent: void insertDebugSignpost(const NS::String*)

Source

pub fn end_encoding(&self)

End encoding.

C++ equivalent: void endEncoding()

Source

pub fn copy_from_buffer_to_buffer( &self, source_buffer: *const c_void, source_offset: UInteger, destination_buffer: *const c_void, destination_offset: UInteger, size: UInteger, )

Copy from buffer to buffer.

C++ equivalent: void copyFromBuffer(...)

Source

pub fn fill_buffer( &self, buffer: *const c_void, range_location: UInteger, range_length: UInteger, value: u8, )

Fill buffer with value.

C++ equivalent: void fillBuffer(const MTL::Buffer*, NS::Range, uint8_t)

Source

pub fn generate_mipmaps(&self, texture: *const c_void)

Generate mipmaps for a texture.

C++ equivalent: void generateMipmaps(const MTL::Texture*)

Source

pub fn optimize_contents_for_cpu_access(&self, texture: *const c_void)

Optimize texture contents for CPU access.

C++ equivalent: void optimizeContentsForCPUAccess(const MTL::Texture*)

Source

pub fn optimize_contents_for_cpu_access_slice_level( &self, texture: *const c_void, slice: UInteger, level: UInteger, )

Optimize texture contents for CPU access with slice and level.

C++ equivalent: void optimizeContentsForCPUAccess(const MTL::Texture*, NS::UInteger, NS::UInteger)

Source

pub fn optimize_contents_for_gpu_access(&self, texture: *const c_void)

Optimize texture contents for GPU access.

C++ equivalent: void optimizeContentsForGPUAccess(const MTL::Texture*)

Source

pub fn optimize_contents_for_gpu_access_slice_level( &self, texture: *const c_void, slice: UInteger, level: UInteger, )

Optimize texture contents for GPU access with slice and level.

C++ equivalent: void optimizeContentsForGPUAccess(const MTL::Texture*, NS::UInteger, NS::UInteger)

Source

pub fn write_timestamp( &self, granularity: TimestampGranularity, counter_heap: *const c_void, index: UInteger, )

Write a timestamp to a counter heap.

C++ equivalent: void writeTimestamp(MTL4::TimestampGranularity, const MTL4::CounterHeap*, NS::UInteger)

Source

pub fn build_acceleration_structure( &self, acceleration_structure: &AccelerationStructure, descriptor: &AccelerationStructureDescriptor, scratch_buffer: BufferRange, )

Build an acceleration structure.

C++ equivalent: void buildAccelerationStructure(const MTL::AccelerationStructure*, const MTL4::AccelerationStructureDescriptor*, const MTL4::BufferRange)

Source

pub fn copy_acceleration_structure( &self, source: &AccelerationStructure, destination: &AccelerationStructure, )

Copy an acceleration structure.

C++ equivalent: void copyAccelerationStructure(const MTL::AccelerationStructure*, const MTL::AccelerationStructure*)

Source

pub fn copy_and_compact_acceleration_structure( &self, source: &AccelerationStructure, destination: &AccelerationStructure, )

Copy and compact an acceleration structure.

C++ equivalent: void copyAndCompactAccelerationStructure(const MTL::AccelerationStructure*, const MTL::AccelerationStructure*)

Source

pub fn refit_acceleration_structure( &self, source: &AccelerationStructure, descriptor: &AccelerationStructureDescriptor, destination: &AccelerationStructure, scratch_buffer: BufferRange, )

Refit an acceleration structure.

C++ equivalent: void refitAccelerationStructure(const MTL::AccelerationStructure*, const MTL4::AccelerationStructureDescriptor*, const MTL::AccelerationStructure*, const MTL4::BufferRange)

Source

pub fn refit_acceleration_structure_with_options( &self, source: &AccelerationStructure, descriptor: &AccelerationStructureDescriptor, destination: &AccelerationStructure, scratch_buffer: BufferRange, options: AccelerationStructureRefitOptions, )

Refit an acceleration structure with options.

C++ equivalent: void refitAccelerationStructure(const MTL::AccelerationStructure*, const MTL4::AccelerationStructureDescriptor*, const MTL::AccelerationStructure*, const MTL4::BufferRange, MTL::AccelerationStructureRefitOptions)

Source

pub fn write_compacted_acceleration_structure_size( &self, acceleration_structure: &AccelerationStructure, buffer: BufferRange, )

Write the compacted acceleration structure size to a buffer.

C++ equivalent: void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure*, const MTL4::BufferRange)

Source

pub fn copy_from_tensor( &self, source_tensor: &Tensor, source_origin: &TensorExtents, source_dimensions: &TensorExtents, destination_tensor: &Tensor, destination_origin: &TensorExtents, destination_dimensions: &TensorExtents, )

Copy from tensor to tensor.

C++ equivalent: void copyFromTensor(const MTL::Tensor*, const MTL::TensorExtents*, const MTL::TensorExtents*, const MTL::Tensor*, const MTL::TensorExtents*, const MTL::TensorExtents*)

Source

pub fn copy_from_texture_to_texture( &self, source_texture: &Texture, destination_texture: &Texture, )

Copy from texture to texture (simple version).

C++ equivalent: void copyFromTexture(const MTL::Texture*, const MTL::Texture*)

Source

pub fn copy_from_texture_with_slices( &self, source_texture: &Texture, source_slice: UInteger, source_level: UInteger, destination_texture: &Texture, destination_slice: UInteger, destination_level: UInteger, slice_count: UInteger, level_count: UInteger, )

Copy from texture to texture with slice and level ranges.

C++ equivalent: void copyFromTexture(const MTL::Texture*, NS::UInteger, NS::UInteger, const MTL::Texture*, NS::UInteger, NS::UInteger, NS::UInteger, NS::UInteger)

Source

pub fn copy_from_texture_with_origin( &self, source_texture: &Texture, source_slice: UInteger, source_level: UInteger, source_origin: Origin, source_size: Size, destination_texture: &Texture, destination_slice: UInteger, destination_level: UInteger, destination_origin: Origin, )

Copy from texture to texture with origin and size.

C++ equivalent: void copyFromTexture(const MTL::Texture*, NS::UInteger, NS::UInteger, MTL::Origin, MTL::Size, const MTL::Texture*, NS::UInteger, NS::UInteger, MTL::Origin)

Source

pub fn copy_from_texture_to_buffer( &self, source_texture: &Texture, source_slice: UInteger, source_level: UInteger, source_origin: Origin, source_size: Size, destination_buffer: &Buffer, destination_offset: UInteger, destination_bytes_per_row: UInteger, destination_bytes_per_image: UInteger, )

Copy from texture to buffer.

C++ equivalent: void copyFromTexture(const MTL::Texture*, NS::UInteger, NS::UInteger, MTL::Origin, MTL::Size, const MTL::Buffer*, NS::UInteger, NS::UInteger, NS::UInteger)

Source

pub fn copy_from_texture_to_buffer_with_options( &self, source_texture: &Texture, source_slice: UInteger, source_level: UInteger, source_origin: Origin, source_size: Size, destination_buffer: &Buffer, destination_offset: UInteger, destination_bytes_per_row: UInteger, destination_bytes_per_image: UInteger, options: BlitOption, )

Copy from texture to buffer with blit options.

C++ equivalent: void copyFromTexture(const MTL::Texture*, NS::UInteger, NS::UInteger, MTL::Origin, MTL::Size, const MTL::Buffer*, NS::UInteger, NS::UInteger, NS::UInteger, MTL::BlitOption)

Source

pub fn copy_indirect_command_buffer( &self, source: &IndirectCommandBuffer, source_range_location: UInteger, source_range_length: UInteger, destination: &IndirectCommandBuffer, destination_index: UInteger, )

Copy indirect command buffer.

C++ equivalent: void copyIndirectCommandBuffer(const MTL::IndirectCommandBuffer*, NS::Range, const MTL::IndirectCommandBuffer*, NS::UInteger)

Source

pub fn optimize_indirect_command_buffer( &self, indirect_command_buffer: &IndirectCommandBuffer, range_location: UInteger, range_length: UInteger, )

Optimize indirect command buffer.

C++ equivalent: void optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer*, NS::Range)

Source

pub fn reset_commands_in_buffer( &self, buffer: &IndirectCommandBuffer, range_location: UInteger, range_length: UInteger, )

Reset commands in an indirect command buffer.

C++ equivalent: void resetCommandsInBuffer(const MTL::IndirectCommandBuffer*, NS::Range)

Source

pub fn execute_commands_in_buffer( &self, indirect_command_buffer: &IndirectCommandBuffer, range_location: UInteger, range_length: UInteger, )

Execute commands in an indirect command buffer.

C++ equivalent: void executeCommandsInBuffer(const MTL::IndirectCommandBuffer*, NS::Range)

Source

pub fn execute_commands_in_buffer_indirect( &self, indirect_command_buffer: &IndirectCommandBuffer, indirect_range_buffer: u64, )

Execute commands in an indirect command buffer with indirect range.

C++ equivalent: void executeCommandsInBuffer(const MTL::IndirectCommandBuffer*, MTL::GPUAddress)

Source

pub fn stages(&self) -> Stages

Get the stages supported by this encoder.

C++ equivalent: MTL::Stages stages()

Trait Implementations§

Source§

impl Clone for ComputeCommandEncoder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ComputeCommandEncoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ComputeCommandEncoder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Referencing for ComputeCommandEncoder

Source§

fn as_ptr(&self) -> *const c_void

Get the raw pointer to the Objective-C object.
Source§

fn as_mut_ptr(&self) -> *mut c_void

Get the raw mutable pointer to the Objective-C object.
Source§

fn retain(&self) -> Self
where Self: Clone,

Retain the object, incrementing its reference count. Read more
Source§

fn release(&self)

Release the object, decrementing its reference count. Read more
Source§

fn autorelease(&self) -> Self
where Self: Clone,

Autorelease the object. Read more
Source§

fn retain_count(&self) -> usize

Get the retain count of the object. Read more
Source§

impl Send for ComputeCommandEncoder

Source§

impl Sync for ComputeCommandEncoder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.