pub unsafe trait MTLBlitCommandEncoder: MTLCommandEncoder {
Show 26 methods
// Provided methods
fn synchronizeResource(&self, resource: &ProtocolObject<dyn MTLResource>)
where Self: Sized + Message { ... }
unsafe fn synchronizeTexture_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
)
where Self: Sized + Message { ... }
unsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
)
where Self: Sized + Message { ... }
unsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
options: MTLBlitOption,
)
where Self: Sized + Message { ... }
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
destination_bytes_per_row: NSUInteger,
destination_bytes_per_image: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
destination_bytes_per_row: NSUInteger,
destination_bytes_per_image: NSUInteger,
options: MTLBlitOption,
)
where Self: Sized + Message { ... }
fn generateMipmapsForTexture(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
)
where Self: Sized + Message { ... }
fn fillBuffer_range_value(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
range: NSRange,
value: u8,
)
where Self: Sized + Message { ... }
unsafe fn copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
slice_count: NSUInteger,
level_count: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn copyFromTexture_toTexture(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
destination_texture: &ProtocolObject<dyn MTLTexture>,
)
where Self: Sized + Message { ... }
unsafe fn copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
size: NSUInteger,
)
where Self: Sized + Message { ... }
fn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>)
where Self: Sized + Message { ... }
fn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>)
where Self: Sized + Message { ... }
unsafe fn getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
reset_counters: bool,
counters_buffer: &ProtocolObject<dyn MTLBuffer>,
counters_buffer_offset: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn resetTextureAccessCounters_region_mipLevel_slice(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
)
where Self: Sized + Message { ... }
fn optimizeContentsForGPUAccess(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
)
where Self: Sized + Message { ... }
unsafe fn optimizeContentsForGPUAccess_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn optimizeContentsForCPUAccess(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
)
where Self: Sized + Message { ... }
unsafe fn optimizeContentsForCPUAccess_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn resetCommandsInBuffer_withRange(
&self,
buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
range: NSRange,
)
where Self: Sized + Message { ... }
unsafe fn copyIndirectCommandBuffer_sourceRange_destination_destinationIndex(
&self,
source: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
source_range: NSRange,
destination: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
destination_index: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn optimizeIndirectCommandBuffer_withRange(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
range: NSRange,
)
where Self: Sized + Message { ... }
unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
sample_index: NSUInteger,
barrier: bool,
)
where Self: Sized + Message { ... }
unsafe fn resolveCounters_inRange_destinationBuffer_destinationOffset(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
range: NSRange,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
)
where Self: Sized + Message { ... }
unsafe fn copyFromTensor_sourceOrigin_sourceDimensions_toTensor_destinationOrigin_destinationDimensions(
&self,
source_tensor: &ProtocolObject<dyn MTLTensor>,
source_origin: &MTLTensorExtents,
source_dimensions: &MTLTensorExtents,
destination_tensor: &ProtocolObject<dyn MTLTensor>,
destination_origin: &MTLTensorExtents,
destination_dimensions: &MTLTensorExtents,
)
where Self: Sized + Message { ... }
}MTLBlitCommandEncoder and MTLCommandEncoder only.Expand description
A command encoder that performs basic copies and blits between buffers and textures.
See also Apple’s documentation
Provided Methods§
Sourcefn synchronizeResource(&self, resource: &ProtocolObject<dyn MTLResource>)
Available on crate features MTLAllocation and MTLResource only.
fn synchronizeResource(&self, resource: &ProtocolObject<dyn MTLResource>)
MTLAllocation and MTLResource only.Flush any copy of this resource from the device’s caches, and invalidate any CPU caches if needed.
Parameter resource: The resource to page off.
When the device writes to a resource with a storage mode of MTLResourceStorageModeManaged, those writes may be cached (for example, in VRAM or on chip renderer cache), making any CPU access (either MTLBuffer.contents or -[MTLTexture getBytes:…] and -[MTLTexture replaceRegion:]) produce undefined results. To allow the CPU to see what the device has written, a CommandBuffer containing this synchronization must be executed. After completion of the CommandBuffer, the CPU can access the contents of the resource safely.
Sourceunsafe fn synchronizeTexture_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
unsafe fn synchronizeTexture_slice_level( &self, texture: &ProtocolObject<dyn MTLTexture>, slice: NSUInteger, level: NSUInteger, )
MTLAllocation and MTLResource and MTLTexture only.Flush any copy of this image from the device’s caches, and invalidate CPU caches if needed.
Parameter texture: The texture to page off.
Parameter slice: The slice of the texture to page off.
Parameter level: The mipmap level of the texture to flush.
See the discussion of -synchronizeResource. -synchronizeTexture:slice:mipmapLevel performs the same role, except it may flush only a subset of the texture storage, rather than the entire texture.
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture and MTLTypes only.
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin( &self, source_texture: &ProtocolObject<dyn MTLTexture>, source_slice: NSUInteger, source_level: NSUInteger, source_origin: MTLOrigin, source_size: MTLSize, destination_texture: &ProtocolObject<dyn MTLTexture>, destination_slice: NSUInteger, destination_level: NSUInteger, destination_origin: MTLOrigin, )
MTLAllocation and MTLResource and MTLTexture and MTLTypes only.Copy a rectangle of pixels between textures.
§Safety
source_texturemay need to be synchronized.source_texturemay be unretained, you must ensure it is kept alive while in use.sourceSizemight not be bounds-checked.destination_texturemay need to be synchronized.destination_texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.
unsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin( &self, source_buffer: &ProtocolObject<dyn MTLBuffer>, source_offset: NSUInteger, source_bytes_per_row: NSUInteger, source_bytes_per_image: NSUInteger, source_size: MTLSize, destination_texture: &ProtocolObject<dyn MTLTexture>, destination_slice: NSUInteger, destination_level: NSUInteger, destination_origin: MTLOrigin, )
MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.Copy an image from a buffer into a texture.
§Safety
source_buffermay need to be synchronized.source_buffermay be unretained, you must ensure it is kept alive while in use.source_buffercontents should be of the correct type.sourceOffsetmight not be bounds-checked.sourceSizemight not be bounds-checked.destination_texturemay need to be synchronized.destination_texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
source_bytes_per_row: NSUInteger,
source_bytes_per_image: NSUInteger,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
destination_origin: MTLOrigin,
options: MTLBlitOption,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.
unsafe fn copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options( &self, source_buffer: &ProtocolObject<dyn MTLBuffer>, source_offset: NSUInteger, source_bytes_per_row: NSUInteger, source_bytes_per_image: NSUInteger, source_size: MTLSize, destination_texture: &ProtocolObject<dyn MTLTexture>, destination_slice: NSUInteger, destination_level: NSUInteger, destination_origin: MTLOrigin, options: MTLBlitOption, )
MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.Copy an image from a buffer into a texture.
§Safety
source_buffermay need to be synchronized.source_buffermay be unretained, you must ensure it is kept alive while in use.source_buffercontents should be of the correct type.sourceOffsetmight not be bounds-checked.sourceSizemight not be bounds-checked.destination_texturemay need to be synchronized.destination_texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
destination_bytes_per_row: NSUInteger,
destination_bytes_per_image: NSUInteger,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage( &self, source_texture: &ProtocolObject<dyn MTLTexture>, source_slice: NSUInteger, source_level: NSUInteger, source_origin: MTLOrigin, source_size: MTLSize, destination_buffer: &ProtocolObject<dyn MTLBuffer>, destination_offset: NSUInteger, destination_bytes_per_row: NSUInteger, destination_bytes_per_image: NSUInteger, )
MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.Copy an image from a texture into a buffer.
§Safety
source_texturemay need to be synchronized.source_texturemay be unretained, you must ensure it is kept alive while in use.sourceSizemight not be bounds-checked.destination_buffermay need to be synchronized.destination_buffermay be unretained, you must ensure it is kept alive while in use.destination_buffercontents should be of the correct type.destinationOffsetmight not be bounds-checked.
Sourceunsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
destination_bytes_per_row: NSUInteger,
destination_bytes_per_image: NSUInteger,
options: MTLBlitOption,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.
unsafe fn copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options( &self, source_texture: &ProtocolObject<dyn MTLTexture>, source_slice: NSUInteger, source_level: NSUInteger, source_origin: MTLOrigin, source_size: MTLSize, destination_buffer: &ProtocolObject<dyn MTLBuffer>, destination_offset: NSUInteger, destination_bytes_per_row: NSUInteger, destination_bytes_per_image: NSUInteger, options: MTLBlitOption, )
MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.Copy an image from a texture into a buffer.
§Safety
source_texturemay need to be synchronized.source_texturemay be unretained, you must ensure it is kept alive while in use.sourceSizemight not be bounds-checked.destination_buffermay need to be synchronized.destination_buffermay be unretained, you must ensure it is kept alive while in use.destination_buffercontents should be of the correct type.destinationOffsetmight not be bounds-checked.
Sourcefn generateMipmapsForTexture(&self, texture: &ProtocolObject<dyn MTLTexture>)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
fn generateMipmapsForTexture(&self, texture: &ProtocolObject<dyn MTLTexture>)
MTLAllocation and MTLResource and MTLTexture only.Generate mipmaps for a texture from the base level up to the max level.
Sourcefn fillBuffer_range_value(
&self,
buffer: &ProtocolObject<dyn MTLBuffer>,
range: NSRange,
value: u8,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource only.
fn fillBuffer_range_value( &self, buffer: &ProtocolObject<dyn MTLBuffer>, range: NSRange, value: u8, )
MTLAllocation and MTLBuffer and MTLResource only.Fill a buffer with a fixed value in each byte.
Sourceunsafe fn copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: NSUInteger,
source_level: NSUInteger,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: NSUInteger,
destination_level: NSUInteger,
slice_count: NSUInteger,
level_count: NSUInteger,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
unsafe fn copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount( &self, source_texture: &ProtocolObject<dyn MTLTexture>, source_slice: NSUInteger, source_level: NSUInteger, destination_texture: &ProtocolObject<dyn MTLTexture>, destination_slice: NSUInteger, destination_level: NSUInteger, slice_count: NSUInteger, level_count: NSUInteger, )
MTLAllocation and MTLResource and MTLTexture only.Copy whole surfaces between textures.
Convenience function to copy sliceCount * levelCount whole surfaces between textures The source and destination pixel format must be identical. The source and destination sample count must be identical. The sourceLevel mip in sourceTexture must have the same dimension as the destinationLevel mip in destinationTexture. The sourceTexture must have at least sourceLevel + levelCount mips The destinationTexture must have at least destinationLevel + levelCount mips The sourceTexture must have at least sourceSlice + sliceCount array slices The destinationTexture must have at least destinationSlice + sliceCount array slices
§Safety
source_texturemay need to be synchronized.source_texturemay be unretained, you must ensure it is kept alive while in use.destination_texturemay need to be synchronized.destination_texturemay be unretained, you must ensure it is kept alive while in use.sliceCountmight not be bounds-checked.levelCountmight not be bounds-checked.
Sourceunsafe fn copyFromTexture_toTexture(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
destination_texture: &ProtocolObject<dyn MTLTexture>,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
unsafe fn copyFromTexture_toTexture( &self, source_texture: &ProtocolObject<dyn MTLTexture>, destination_texture: &ProtocolObject<dyn MTLTexture>, )
MTLAllocation and MTLResource and MTLTexture only.Copy as many whole surfaces as possible between textures.
Convenience function that calls copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount: The source and destination pixel format must be identical. The source and destination sample count must be identical. Either:
- sourceTexture must have a mip M with identical dimensions as the first mip of destinationTexture: sourceLevel = M, destinationLevel = 0
- destinationTexture must have a mip M with identical dimensions as the first mip of sourceTexture: sourceLevel = 0, destinationLevel = M Computes: levelCount = min(sourceTexture.mipmapLevelCount - sourceLevel, destinationTexture.mipmapLevelCount - destinationLevel) sliceCount = min(sourceTexture.arrayLength, destinationTexture.arrayLength) Then invokes the method above using the computed parameters.
§Safety
source_texturemay need to be synchronized.source_texturemay be unretained, you must ensure it is kept alive while in use.destination_texturemay need to be synchronized.destination_texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size(
&self,
source_buffer: &ProtocolObject<dyn MTLBuffer>,
source_offset: NSUInteger,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
size: NSUInteger,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource only.
unsafe fn copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size( &self, source_buffer: &ProtocolObject<dyn MTLBuffer>, source_offset: NSUInteger, destination_buffer: &ProtocolObject<dyn MTLBuffer>, destination_offset: NSUInteger, size: NSUInteger, )
MTLAllocation and MTLBuffer and MTLResource only.Basic memory copy between buffers.
§Safety
source_buffermay need to be synchronized.source_buffermay be unretained, you must ensure it is kept alive while in use.source_buffercontents should be of the correct type.sourceOffsetmight not be bounds-checked.destination_buffermay need to be synchronized.destination_buffermay be unretained, you must ensure it is kept alive while in use.destination_buffercontents should be of the correct type.destinationOffsetmight not be bounds-checked.sizemight not be bounds-checked.
Sourcefn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>)
Available on crate feature MTLFence only.
fn updateFence(&self, fence: &ProtocolObject<dyn MTLFence>)
MTLFence only.Update the fence to capture all GPU work so far enqueued by this encoder.
The fence is updated at kernel submission to maintain global order and prevent deadlock. Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
Sourcefn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>)
Available on crate feature MTLFence only.
fn waitForFence(&self, fence: &ProtocolObject<dyn MTLFence>)
MTLFence only.Prevent further GPU work until the fence is reached.
The fence is evaluated at kernel submission to maintain global order and prevent deadlock. Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
Sourceunsafe fn getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
reset_counters: bool,
counters_buffer: &ProtocolObject<dyn MTLBuffer>,
counters_buffer_offset: NSUInteger,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.
unsafe fn getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset( &self, texture: &ProtocolObject<dyn MTLTexture>, region: MTLRegion, mip_level: NSUInteger, slice: NSUInteger, reset_counters: bool, counters_buffer: &ProtocolObject<dyn MTLBuffer>, counters_buffer_offset: NSUInteger, )
MTLAllocation and MTLBuffer and MTLResource and MTLTexture and MTLTypes only.Copies tile access counters within specified region into provided buffer
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.counters_buffermay need to be synchronized.counters_buffermay be unretained, you must ensure it is kept alive while in use.counters_buffercontents should be of the correct type.countersBufferOffsetmight not be bounds-checked.
Sourceunsafe fn resetTextureAccessCounters_region_mipLevel_slice(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
region: MTLRegion,
mip_level: NSUInteger,
slice: NSUInteger,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture and MTLTypes only.
unsafe fn resetTextureAccessCounters_region_mipLevel_slice( &self, texture: &ProtocolObject<dyn MTLTexture>, region: MTLRegion, mip_level: NSUInteger, slice: NSUInteger, )
MTLAllocation and MTLResource and MTLTexture and MTLTypes only.Resets tile access counters within specified region
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.- This might not be bounds-checked.
Sourcefn optimizeContentsForGPUAccess(&self, texture: &ProtocolObject<dyn MTLTexture>)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
fn optimizeContentsForGPUAccess(&self, texture: &ProtocolObject<dyn MTLTexture>)
MTLAllocation and MTLResource and MTLTexture only.Optimizes the texture data to ensure the best possible performance when accessing content on the GPU at the expense of CPU-access performance.
Sourceunsafe fn optimizeContentsForGPUAccess_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
unsafe fn optimizeContentsForGPUAccess_slice_level( &self, texture: &ProtocolObject<dyn MTLTexture>, slice: NSUInteger, level: NSUInteger, )
MTLAllocation and MTLResource and MTLTexture only.Optimizes a subset of the texture data to ensure the best possible performance when accessing content on the GPU at the expense of CPU-access performance.
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn optimizeContentsForCPUAccess(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
unsafe fn optimizeContentsForCPUAccess( &self, texture: &ProtocolObject<dyn MTLTexture>, )
MTLAllocation and MTLResource and MTLTexture only.Optimizes the texture data to ensure the best possible performance when accessing content on the CPU at the expense of GPU-access performance.
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn optimizeContentsForCPUAccess_slice_level(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
slice: NSUInteger,
level: NSUInteger,
)
Available on crate features MTLAllocation and MTLResource and MTLTexture only.
unsafe fn optimizeContentsForCPUAccess_slice_level( &self, texture: &ProtocolObject<dyn MTLTexture>, slice: NSUInteger, level: NSUInteger, )
MTLAllocation and MTLResource and MTLTexture only.Optimizes a subset of the texture data to ensure the best possible performance when accessing content on the CPU at the expense of GPU-access performance.
§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.
Sourceunsafe fn resetCommandsInBuffer_withRange(
&self,
buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
range: NSRange,
)
Available on crate features MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.
unsafe fn resetCommandsInBuffer_withRange( &self, buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>, range: NSRange, )
MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.reset commands in a indirect command buffer using the GPU
§Safety
buffermay need to be synchronized.buffermay be unretained, you must ensure it is kept alive while in use.rangemight not be bounds-checked.
Sourceunsafe fn copyIndirectCommandBuffer_sourceRange_destination_destinationIndex(
&self,
source: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
source_range: NSRange,
destination: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
destination_index: NSUInteger,
)
Available on crate features MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.
unsafe fn copyIndirectCommandBuffer_sourceRange_destination_destinationIndex( &self, source: &ProtocolObject<dyn MTLIndirectCommandBuffer>, source_range: NSRange, destination: &ProtocolObject<dyn MTLIndirectCommandBuffer>, destination_index: NSUInteger, )
MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.copy a region of a buffer into a destination buffer starting at destinationIndex using the GPU
§Safety
sourcemay need to be synchronized.sourcemay be unretained, you must ensure it is kept alive while in use.sourceRangemight not be bounds-checked.destinationmay need to be synchronized.destinationmay be unretained, you must ensure it is kept alive while in use.destinationIndexmight not be bounds-checked.
Sourceunsafe fn optimizeIndirectCommandBuffer_withRange(
&self,
indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
range: NSRange,
)
Available on crate features MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.
unsafe fn optimizeIndirectCommandBuffer_withRange( &self, indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>, range: NSRange, )
MTLAllocation and MTLIndirectCommandBuffer and MTLResource only.Encodes a command that can improve the performance of a range of commands within an indirect command buffer.
§Safety
indirect_command_buffermay need to be synchronized.indirect_command_buffermay be unretained, you must ensure it is kept alive while in use.rangemight not be bounds-checked.
Sourceunsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
sample_index: NSUInteger,
barrier: bool,
)
Available on crate feature MTLCounters only.
unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier( &self, sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>, sample_index: NSUInteger, barrier: bool, )
MTLCounters only.Sample hardware counters at this point in the blit encoder and store the counter sample into the sample buffer at the specified index.
Parameter sampleBuffer: The sample buffer to sample into
Parameter sampleIndex: The index into the counter buffer to write the sample.
Parameter barrier: Insert a barrier before taking the sample. Passing
YES will ensure that all work encoded before this operation in the encoder is
complete but does not isolate the work with respect to other encoders. Passing
NO will allow the sample to be taken concurrently with other operations in this
encoder.
In general, passing YES will lead to more repeatable counter results but
may negatively impact performance. Passing NO will generally be higher performance
but counter results may not be repeatable.
On devices where MTLCounterSamplingPointAtBlitBoundary is unsupported, this method is not available and will generate an error if called.
§Safety
sampleIndex might not be bounds-checked.
Sourceunsafe fn resolveCounters_inRange_destinationBuffer_destinationOffset(
&self,
sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
range: NSRange,
destination_buffer: &ProtocolObject<dyn MTLBuffer>,
destination_offset: NSUInteger,
)
Available on crate features MTLAllocation and MTLBuffer and MTLCounters and MTLResource only.
unsafe fn resolveCounters_inRange_destinationBuffer_destinationOffset( &self, sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>, range: NSRange, destination_buffer: &ProtocolObject<dyn MTLBuffer>, destination_offset: NSUInteger, )
MTLAllocation and MTLBuffer and MTLCounters and MTLResource only.Parameter sampleBuffer: The sample buffer to resolve.
Parameter range: The range of indices to resolve.
Parameter destinationBuffer: The buffer to resolve values into.
Parameter destinationOffset: The offset to begin writing values out to. This must be a multiple of
the minimum constant buffer alignment.
Resolve the counters from the raw buffer to a processed buffer.
Samples that encountered an error during resolve will be set to MTLCounterErrorValue.
§Safety
rangemight not be bounds-checked.destination_buffermay need to be synchronized.destination_buffermay be unretained, you must ensure it is kept alive while in use.destination_buffercontents should be of the correct type.destinationOffsetmight not be bounds-checked.
Sourceunsafe fn copyFromTensor_sourceOrigin_sourceDimensions_toTensor_destinationOrigin_destinationDimensions(
&self,
source_tensor: &ProtocolObject<dyn MTLTensor>,
source_origin: &MTLTensorExtents,
source_dimensions: &MTLTensorExtents,
destination_tensor: &ProtocolObject<dyn MTLTensor>,
destination_origin: &MTLTensorExtents,
destination_dimensions: &MTLTensorExtents,
)
Available on crate features MTLAllocation and MTLResource and MTLTensor only.
unsafe fn copyFromTensor_sourceOrigin_sourceDimensions_toTensor_destinationOrigin_destinationDimensions( &self, source_tensor: &ProtocolObject<dyn MTLTensor>, source_origin: &MTLTensorExtents, source_dimensions: &MTLTensorExtents, destination_tensor: &ProtocolObject<dyn MTLTensor>, destination_origin: &MTLTensorExtents, destination_dimensions: &MTLTensorExtents, )
MTLAllocation and MTLResource and MTLTensor only.Encodes a command to copy data from a slice of one tensor into a slice of another tensor.
This command applies reshapes if sourceTensor and destinationTensor are not aliasable.
- Parameters:
- sourceTensor: A tensor instance that this command copies data from.
- sourceOrigin: An array of offsets, in elements, to the first element of the slice of
sourceTensorthat this command copies data from. - sourceDimensions: An array of sizes, in elements, of the slice
sourceTensorthat this command copies data from. - destinationTensor: A tensor instance that this command copies data to.
- destinationOrigin: An array of offsets, in elements, to the first element of the slice of
destinationTensorthat this command copies data to. - destinationDimensions: An array of sizes, in elements, of the slice of
destinationTensorthat this command copies data to.
§Safety
source_tensormay need to be synchronized.source_tensormay be unretained, you must ensure it is kept alive while in use.destination_tensormay need to be synchronized.destination_tensormay be unretained, you must ensure it is kept alive while in use.