Skip to main content

BlitCommandEncoder

Struct BlitCommandEncoder 

Source
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

Source

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.

Source

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

Get the raw pointer to the encoder.

Source

pub fn device(&self) -> Device

Get the device that created this encoder.

C++ equivalent: Device* device() const

Source

pub fn command_buffer(&self) -> CommandBuffer

Get the command buffer that this encoder is encoding into.

C++ equivalent: CommandBuffer* commandBuffer() const

Source

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

Get the label for this encoder.

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

Source

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

Set the label for this encoder.

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

Source

pub fn end_encoding(&self)

End encoding commands with this encoder.

C++ equivalent: void endEncoding()

Source

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

Insert a debug signpost.

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

Source

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

Push a debug group.

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

Source

pub fn pop_debug_group(&self)

Pop the current debug group.

C++ equivalent: void popDebugGroup()

Source

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)

Source

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.

Source

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)

Source

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...)

Source

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:)

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 data from a texture to a buffer.

C++ equivalent: void copyFromTexture(...toBuffer...)

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 data from a texture to a buffer with options.

C++ equivalent: void copyFromTexture(...toBuffer...options:)

Source

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*)

Source

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...)

Source

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:)

Source

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)

Source

pub fn generate_mipmaps(&self, texture: &Texture)

Generate mipmaps for a texture.

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

Source

pub fn optimize_contents_for_cpu_access(&self, texture: &Texture)

Optimize a texture’s contents for CPU access.

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

Source

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)

Source

pub fn optimize_contents_for_gpu_access(&self, texture: &Texture)

Optimize a texture’s contents for GPU access.

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

Source

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)

Source

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.

Source

pub fn synchronize_buffer(&self, buffer: &Buffer)

Synchronize a managed buffer.

C++ equivalent: void synchronizeResource(const Resource*)

Source

pub fn synchronize_texture(&self, texture: &Texture)

Synchronize a managed texture.

C++ equivalent: void synchronizeResource(const Resource*)

Source

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)

Source

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.

Source

pub fn update_fence(&self, fence: &Fence)

Update a fence.

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

Source

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.

Source

pub fn wait_for_fence(&self, fence: &Fence)

Wait for a fence.

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

Source

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(...)

Source

pub fn reset_texture_access_counters( &self, texture: &Texture, region: Region, mip_level: UInteger, slice: UInteger, )

Reset texture access counters.

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for BlitCommandEncoder

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 BlitCommandEncoder

Source§

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

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

impl Drop for BlitCommandEncoder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Referencing for BlitCommandEncoder

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 BlitCommandEncoder

Source§

impl Sync for BlitCommandEncoder

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.