pub struct BlitCommandEncoder(/* private fields */);Expand description
A command encoder for data transfer operations.
C++ equivalent: MTL::BlitCommandEncoder
Blit encoders are used to copy data between buffers and textures, generate mipmaps, and synchronize resources.
Implementations§
Source§impl BlitCommandEncoder
impl BlitCommandEncoder
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create a BlitCommandEncoder from a raw pointer.
§Safety
The pointer must be a valid Metal blit command encoder object.
Sourcepub fn device(&self) -> Device
pub fn device(&self) -> Device
Get the device that created this encoder.
C++ equivalent: Device* device() const
Sourcepub fn command_buffer(&self) -> CommandBuffer
pub fn command_buffer(&self) -> CommandBuffer
Get the command buffer that this encoder is encoding into.
C++ equivalent: CommandBuffer* commandBuffer() const
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Get the label for this encoder.
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 encoder.
C++ equivalent: void setLabel(const NS::String*)
Sourcepub fn end_encoding(&self)
pub fn end_encoding(&self)
End encoding commands with this encoder.
C++ equivalent: void endEncoding()
Sourcepub fn insert_debug_signpost(&self, string: &str)
pub fn insert_debug_signpost(&self, string: &str)
Insert a debug signpost.
C++ equivalent: void insertDebugSignpost(const NS::String*)
Sourcepub fn push_debug_group(&self, string: &str)
pub fn push_debug_group(&self, string: &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 the current debug group.
C++ equivalent: void popDebugGroup()
Sourcepub fn barrier_after_queue_stages(
&self,
after_stages: Stages,
before_stages: Stages,
)
pub fn barrier_after_queue_stages( &self, after_stages: Stages, before_stages: Stages, )
Insert a barrier to synchronize queue stages.
C++ equivalent: void barrierAfterQueueStages(Stages, Stages)
Sourcepub unsafe fn copy_from_tensor_ptr(
&self,
source_tensor: *const c_void,
source_origin: *const c_void,
source_dimensions: *const c_void,
destination_tensor: *const c_void,
destination_origin: *const c_void,
destination_dimensions: *const c_void,
)
pub unsafe fn copy_from_tensor_ptr( &self, source_tensor: *const c_void, source_origin: *const c_void, source_dimensions: *const c_void, destination_tensor: *const c_void, destination_origin: *const c_void, destination_dimensions: *const c_void, )
Copy data from one tensor to another (raw pointer version).
C++ equivalent: void copyFromTensor(...)
§Safety
All tensor and extents pointers must be valid Metal tensor/extents objects.
Sourcepub fn copy_from_buffer_to_buffer(
&self,
source_buffer: &Buffer,
source_offset: UInteger,
destination_buffer: &Buffer,
destination_offset: UInteger,
size: UInteger,
)
pub fn copy_from_buffer_to_buffer( &self, source_buffer: &Buffer, source_offset: UInteger, destination_buffer: &Buffer, destination_offset: UInteger, size: UInteger, )
Copy data from one buffer to another.
C++ equivalent: void copyFromBuffer(const Buffer*, NS::UInteger, const Buffer*, NS::UInteger, NS::UInteger)
Sourcepub fn copy_from_buffer_to_texture(
&self,
source_buffer: &Buffer,
source_offset: UInteger,
source_bytes_per_row: UInteger,
source_bytes_per_image: UInteger,
source_size: Size,
destination_texture: &Texture,
destination_slice: UInteger,
destination_level: UInteger,
destination_origin: Origin,
)
pub fn copy_from_buffer_to_texture( &self, source_buffer: &Buffer, source_offset: UInteger, source_bytes_per_row: UInteger, source_bytes_per_image: UInteger, source_size: Size, destination_texture: &Texture, destination_slice: UInteger, destination_level: UInteger, destination_origin: Origin, )
Copy data from a buffer to a texture.
C++ equivalent: void copyFromBuffer(...toTexture...)
Sourcepub fn copy_from_buffer_to_texture_with_options(
&self,
source_buffer: &Buffer,
source_offset: UInteger,
source_bytes_per_row: UInteger,
source_bytes_per_image: UInteger,
source_size: Size,
destination_texture: &Texture,
destination_slice: UInteger,
destination_level: UInteger,
destination_origin: Origin,
options: BlitOption,
)
pub fn copy_from_buffer_to_texture_with_options( &self, source_buffer: &Buffer, source_offset: UInteger, source_bytes_per_row: UInteger, source_bytes_per_image: UInteger, source_size: Size, destination_texture: &Texture, destination_slice: UInteger, destination_level: UInteger, destination_origin: Origin, options: BlitOption, )
Copy data from a buffer to a texture with options.
C++ equivalent: void copyFromBuffer(...toTexture...options:)
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 data from a texture to a buffer.
C++ equivalent: void copyFromTexture(...toBuffer...)
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 data from a texture to a buffer with options.
C++ equivalent: void copyFromTexture(...toBuffer...options:)
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 data from one texture to another (full copy).
C++ equivalent: void copyFromTexture(const Texture*, const Texture*)
Sourcepub fn copy_from_texture_to_texture_region(
&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_to_texture_region( &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 data from one texture to another (region copy).
C++ equivalent: void copyFromTexture(...toTexture...)
Sourcepub fn copy_from_texture_to_texture_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_to_texture_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 slices and levels between textures.
C++ equivalent: void copyFromTexture(...sliceCount: levelCount:)
Sourcepub fn fill_buffer(
&self,
buffer: &Buffer,
offset: UInteger,
length: UInteger,
value: u8,
)
pub fn fill_buffer( &self, buffer: &Buffer, offset: UInteger, length: UInteger, value: u8, )
Fill a buffer with a value.
C++ equivalent: void fillBuffer(const Buffer*, NS::Range, uint8_t)
Sourcepub fn generate_mipmaps(&self, texture: &Texture)
pub fn generate_mipmaps(&self, texture: &Texture)
Generate mipmaps for a texture.
C++ equivalent: void generateMipmaps(const Texture*)
Sourcepub fn optimize_contents_for_cpu_access(&self, texture: &Texture)
pub fn optimize_contents_for_cpu_access(&self, texture: &Texture)
Optimize a texture’s contents for CPU access.
C++ equivalent: void optimizeContentsForCPUAccess(const Texture*)
Sourcepub fn optimize_contents_for_cpu_access_slice(
&self,
texture: &Texture,
slice: UInteger,
level: UInteger,
)
pub fn optimize_contents_for_cpu_access_slice( &self, texture: &Texture, slice: UInteger, level: UInteger, )
Optimize a texture slice’s contents for CPU access.
C++ equivalent: void optimizeContentsForCPUAccess(const Texture*, NS::UInteger, NS::UInteger)
Sourcepub fn optimize_contents_for_gpu_access(&self, texture: &Texture)
pub fn optimize_contents_for_gpu_access(&self, texture: &Texture)
Optimize a texture’s contents for GPU access.
C++ equivalent: void optimizeContentsForGPUAccess(const Texture*)
Sourcepub fn optimize_contents_for_gpu_access_slice(
&self,
texture: &Texture,
slice: UInteger,
level: UInteger,
)
pub fn optimize_contents_for_gpu_access_slice( &self, texture: &Texture, slice: UInteger, level: UInteger, )
Optimize a texture slice’s contents for GPU access.
C++ equivalent: void optimizeContentsForGPUAccess(const Texture*, NS::UInteger, NS::UInteger)
Sourcepub unsafe fn synchronize_resource_ptr(&self, resource: *const c_void)
pub unsafe fn synchronize_resource_ptr(&self, resource: *const c_void)
Synchronize a managed resource (raw pointer version).
This ensures the GPU’s copy of a managed resource is synchronized with the CPU.
C++ equivalent: void synchronizeResource(const Resource*)
§Safety
The resource pointer must be a valid Metal resource object.
Sourcepub fn synchronize_buffer(&self, buffer: &Buffer)
pub fn synchronize_buffer(&self, buffer: &Buffer)
Synchronize a managed buffer.
C++ equivalent: void synchronizeResource(const Resource*)
Sourcepub fn synchronize_texture(&self, texture: &Texture)
pub fn synchronize_texture(&self, texture: &Texture)
Synchronize a managed texture.
C++ equivalent: void synchronizeResource(const Resource*)
Sourcepub fn synchronize_texture_slice(
&self,
texture: &Texture,
slice: UInteger,
level: UInteger,
)
pub fn synchronize_texture_slice( &self, texture: &Texture, slice: UInteger, level: UInteger, )
Synchronize a texture slice.
C++ equivalent: void synchronizeTexture(const Texture*, NS::UInteger, NS::UInteger)
Sourcepub unsafe fn update_fence_ptr(&self, fence: *const c_void)
pub unsafe fn update_fence_ptr(&self, fence: *const c_void)
Update a fence (raw pointer version).
C++ equivalent: void updateFence(const Fence*)
§Safety
The fence pointer must be a valid Metal fence object.
Sourcepub fn update_fence(&self, fence: &Fence)
pub fn update_fence(&self, fence: &Fence)
Update a fence.
C++ equivalent: void updateFence(const Fence*)
Sourcepub unsafe fn wait_for_fence_ptr(&self, fence: *const c_void)
pub unsafe fn wait_for_fence_ptr(&self, fence: *const c_void)
Wait for a fence (raw pointer version).
C++ equivalent: void waitForFence(const Fence*)
§Safety
The fence pointer must be a valid Metal fence object.
Sourcepub fn wait_for_fence(&self, fence: &Fence)
pub fn wait_for_fence(&self, fence: &Fence)
Wait for a fence.
C++ equivalent: void waitForFence(const Fence*)
Sourcepub fn get_texture_access_counters(
&self,
texture: &Texture,
region: Region,
mip_level: UInteger,
slice: UInteger,
reset_counters: bool,
counters_buffer: &Buffer,
counters_buffer_offset: UInteger,
)
pub fn get_texture_access_counters( &self, texture: &Texture, region: Region, mip_level: UInteger, slice: UInteger, reset_counters: bool, counters_buffer: &Buffer, counters_buffer_offset: UInteger, )
Get texture access counters.
C++ equivalent: void getTextureAccessCounters(...)
Sourcepub fn reset_texture_access_counters(
&self,
texture: &Texture,
region: Region,
mip_level: UInteger,
slice: UInteger,
)
pub fn reset_texture_access_counters( &self, texture: &Texture, region: Region, mip_level: UInteger, slice: UInteger, )
Reset texture access counters.
C++ equivalent: void resetTextureAccessCounters(...)
Sourcepub unsafe fn copy_indirect_command_buffer_ptr(
&self,
source: *const c_void,
source_offset: UInteger,
source_length: UInteger,
destination: *const c_void,
destination_index: UInteger,
)
pub unsafe fn copy_indirect_command_buffer_ptr( &self, source: *const c_void, source_offset: UInteger, source_length: UInteger, destination: *const c_void, destination_index: UInteger, )
Copy an indirect command buffer (raw pointer version).
C++ equivalent: void copyIndirectCommandBuffer(...)
§Safety
The source and destination pointers must be valid indirect command buffer objects.
Sourcepub unsafe fn optimize_indirect_command_buffer_ptr(
&self,
indirect_command_buffer: *const c_void,
offset: UInteger,
length: UInteger,
)
pub unsafe fn optimize_indirect_command_buffer_ptr( &self, indirect_command_buffer: *const c_void, offset: UInteger, length: UInteger, )
Optimize an indirect command buffer (raw pointer version).
C++ equivalent: void optimizeIndirectCommandBuffer(...)
§Safety
The indirect command buffer pointer must be valid.
Sourcepub unsafe fn reset_commands_in_buffer_ptr(
&self,
buffer: *const c_void,
offset: UInteger,
length: UInteger,
)
pub unsafe fn reset_commands_in_buffer_ptr( &self, buffer: *const c_void, offset: UInteger, length: UInteger, )
Reset commands in an indirect command buffer (raw pointer version).
C++ equivalent: void resetCommandsInBuffer(...)
§Safety
The buffer pointer must be a valid indirect command buffer object.
Sourcepub unsafe fn sample_counters_in_buffer_ptr(
&self,
sample_buffer: *const c_void,
sample_index: UInteger,
barrier: bool,
)
pub unsafe fn sample_counters_in_buffer_ptr( &self, sample_buffer: *const c_void, sample_index: UInteger, barrier: bool, )
Sample counters (raw pointer version).
C++ equivalent: void sampleCountersInBuffer(...)
§Safety
The sample buffer pointer must be a valid counter sample buffer object.
Sourcepub unsafe fn resolve_counters_ptr(
&self,
sample_buffer: *const c_void,
offset: UInteger,
length: UInteger,
destination_buffer: &Buffer,
destination_offset: UInteger,
)
pub unsafe fn resolve_counters_ptr( &self, sample_buffer: *const c_void, offset: UInteger, length: UInteger, destination_buffer: &Buffer, destination_offset: UInteger, )
Resolve counters (raw pointer version).
C++ equivalent: void resolveCounters(...)
§Safety
The sample buffer pointer must be a valid counter sample buffer object.