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
impl ComputeCommandEncoder
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create a ComputeCommandEncoder 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*)
Sourcepub fn set_compute_pipeline_state(&self, pipeline: &ComputePipelineState)
pub fn set_compute_pipeline_state(&self, pipeline: &ComputePipelineState)
Set the compute pipeline state.
C++ equivalent: void setComputePipelineState(const MTL::ComputePipelineState*)
Sourcepub fn set_argument_table(&self, table: *const c_void, index: UInteger)
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)
Sourcepub fn set_buffer(
&self,
buffer: *const c_void,
offset: UInteger,
index: UInteger,
)
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)
Sourcepub fn set_buffers(
&self,
buffers: *const *const c_void,
offsets: *const UInteger,
range_location: UInteger,
range_length: UInteger,
)
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)
Sourcepub fn set_bytes(&self, bytes: *const c_void, length: UInteger, index: UInteger)
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)
Sourcepub fn set_texture(&self, texture: *const c_void, index: UInteger)
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)
Sourcepub fn set_textures(
&self,
textures: *const *const c_void,
range_location: UInteger,
range_length: UInteger,
)
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)
Sourcepub fn set_sampler_state(&self, sampler: *const c_void, index: UInteger)
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)
Sourcepub fn set_sampler_state_with_lod(
&self,
sampler: *const c_void,
lod_min_clamp: f32,
lod_max_clamp: f32,
index: UInteger,
)
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)
Sourcepub fn set_threadgroup_memory_length(&self, length: UInteger, index: UInteger)
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)
Sourcepub fn dispatch_threadgroups(
&self,
threadgroups_per_grid: Size,
threads_per_threadgroup: Size,
)
pub fn dispatch_threadgroups( &self, threadgroups_per_grid: Size, threads_per_threadgroup: Size, )
Dispatch threadgroups.
C++ equivalent: void dispatchThreadgroups(MTL::Size, MTL::Size)
Sourcepub fn dispatch_threads(
&self,
threads_per_grid: Size,
threads_per_threadgroup: Size,
)
pub fn dispatch_threads( &self, threads_per_grid: Size, threads_per_threadgroup: Size, )
Dispatch threads.
C++ equivalent: void dispatchThreads(MTL::Size, MTL::Size)
Sourcepub fn dispatch_threadgroups_indirect(
&self,
indirect_buffer: *const c_void,
indirect_buffer_offset: UInteger,
threads_per_threadgroup: Size,
)
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)
Sourcepub fn dispatch_threads_indirect(
&self,
indirect_buffer: *const c_void,
indirect_buffer_offset: UInteger,
threads_per_threadgroup: Size,
)
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)
Sourcepub fn barrier_buffer(
&self,
buffer: *const c_void,
visibility: VisibilityOptions,
)
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)
Sourcepub fn barrier_texture(
&self,
texture: *const c_void,
visibility: VisibilityOptions,
)
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)
Sourcepub fn update_fence(&self, fence: *const c_void)
pub fn update_fence(&self, fence: *const c_void)
Update a fence.
C++ equivalent: void updateFence(const MTL::Fence*)
Sourcepub fn wait_for_fence(&self, fence: *const c_void)
pub fn wait_for_fence(&self, fence: *const c_void)
Wait for a fence.
C++ equivalent: void waitForFence(const MTL::Fence*)
Sourcepub fn use_resource(&self, resource: *const c_void, usage: UInteger)
pub fn use_resource(&self, resource: *const c_void, usage: UInteger)
Use resource with usage.
C++ equivalent: void useResource(const MTL::Resource*, MTL::ResourceUsage)
Sourcepub fn use_resources(
&self,
resources: *const *const c_void,
count: UInteger,
usage: UInteger,
)
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)
Sourcepub fn use_heap(&self, heap: *const c_void, usage: UInteger)
pub fn use_heap(&self, heap: *const c_void, usage: UInteger)
Use heap with usage.
C++ equivalent: void useHeap(const MTL::Heap*, MTL::ResourceUsage)
Sourcepub fn use_heaps(
&self,
heaps: *const *const c_void,
count: UInteger,
usage: UInteger,
)
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)
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*)
Sourcepub fn pop_debug_group(&self)
pub fn pop_debug_group(&self)
Pop a debug group.
C++ equivalent: void popDebugGroup()
Sourcepub fn insert_debug_signpost(&self, name: &str)
pub fn insert_debug_signpost(&self, name: &str)
Insert a debug signpost.
C++ equivalent: void insertDebugSignpost(const NS::String*)
Sourcepub fn end_encoding(&self)
pub fn end_encoding(&self)
End encoding.
C++ equivalent: void endEncoding()
Sourcepub 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,
)
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(...)
Sourcepub fn fill_buffer(
&self,
buffer: *const c_void,
range_location: UInteger,
range_length: UInteger,
value: u8,
)
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)
Sourcepub fn generate_mipmaps(&self, texture: *const c_void)
pub fn generate_mipmaps(&self, texture: *const c_void)
Generate mipmaps for a texture.
C++ equivalent: void generateMipmaps(const MTL::Texture*)
Sourcepub fn optimize_contents_for_cpu_access(&self, texture: *const c_void)
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*)
Sourcepub fn optimize_contents_for_cpu_access_slice_level(
&self,
texture: *const c_void,
slice: UInteger,
level: UInteger,
)
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)
Sourcepub fn optimize_contents_for_gpu_access(&self, texture: *const c_void)
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*)
Sourcepub fn optimize_contents_for_gpu_access_slice_level(
&self,
texture: *const c_void,
slice: UInteger,
level: UInteger,
)
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)
Sourcepub fn write_timestamp(
&self,
granularity: TimestampGranularity,
counter_heap: *const c_void,
index: UInteger,
)
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)
Sourcepub fn build_acceleration_structure(
&self,
acceleration_structure: &AccelerationStructure,
descriptor: &AccelerationStructureDescriptor,
scratch_buffer: BufferRange,
)
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)
Sourcepub fn copy_acceleration_structure(
&self,
source: &AccelerationStructure,
destination: &AccelerationStructure,
)
pub fn copy_acceleration_structure( &self, source: &AccelerationStructure, destination: &AccelerationStructure, )
Copy an acceleration structure.
C++ equivalent: void copyAccelerationStructure(const MTL::AccelerationStructure*, const MTL::AccelerationStructure*)
Sourcepub fn copy_and_compact_acceleration_structure(
&self,
source: &AccelerationStructure,
destination: &AccelerationStructure,
)
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*)
Sourcepub fn refit_acceleration_structure(
&self,
source: &AccelerationStructure,
descriptor: &AccelerationStructureDescriptor,
destination: &AccelerationStructure,
scratch_buffer: BufferRange,
)
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)
Sourcepub fn refit_acceleration_structure_with_options(
&self,
source: &AccelerationStructure,
descriptor: &AccelerationStructureDescriptor,
destination: &AccelerationStructure,
scratch_buffer: BufferRange,
options: AccelerationStructureRefitOptions,
)
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)
Sourcepub fn write_compacted_acceleration_structure_size(
&self,
acceleration_structure: &AccelerationStructure,
buffer: BufferRange,
)
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)
Sourcepub fn copy_from_tensor(
&self,
source_tensor: &Tensor,
source_origin: &TensorExtents,
source_dimensions: &TensorExtents,
destination_tensor: &Tensor,
destination_origin: &TensorExtents,
destination_dimensions: &TensorExtents,
)
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*)
Sourcepub fn copy_from_texture_to_texture(
&self,
source_texture: &Texture,
destination_texture: &Texture,
)
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*)
Sourcepub 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,
)
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)
Sourcepub 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,
)
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)
Sourcepub 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,
)
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)
Sourcepub 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,
)
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)
Sourcepub fn copy_indirect_command_buffer(
&self,
source: &IndirectCommandBuffer,
source_range_location: UInteger,
source_range_length: UInteger,
destination: &IndirectCommandBuffer,
destination_index: UInteger,
)
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)
Sourcepub fn optimize_indirect_command_buffer(
&self,
indirect_command_buffer: &IndirectCommandBuffer,
range_location: UInteger,
range_length: UInteger,
)
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)
Sourcepub fn reset_commands_in_buffer(
&self,
buffer: &IndirectCommandBuffer,
range_location: UInteger,
range_length: UInteger,
)
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)
Sourcepub fn execute_commands_in_buffer(
&self,
indirect_command_buffer: &IndirectCommandBuffer,
range_location: UInteger,
range_length: UInteger,
)
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)
Sourcepub fn execute_commands_in_buffer_indirect(
&self,
indirect_command_buffer: &IndirectCommandBuffer,
indirect_range_buffer: u64,
)
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)