pub struct Heap(/* private fields */);Expand description
A memory pool from which resources can be allocated.
C++ equivalent: MTL::Heap
Implementations§
Source§impl Heap
impl Heap
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Get the label for this heap.
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 heap.
C++ equivalent: void setLabel(const NS::String*)
Sourcepub fn device(&self) -> Device
pub fn device(&self) -> Device
Get the device that created this heap.
C++ equivalent: Device* device() const
Sourcepub fn storage_mode(&self) -> StorageMode
pub fn storage_mode(&self) -> StorageMode
Get the storage mode.
C++ equivalent: StorageMode storageMode() const
Sourcepub fn cpu_cache_mode(&self) -> CPUCacheMode
pub fn cpu_cache_mode(&self) -> CPUCacheMode
Get the CPU cache mode.
C++ equivalent: CPUCacheMode cpuCacheMode() const
Sourcepub fn hazard_tracking_mode(&self) -> HazardTrackingMode
pub fn hazard_tracking_mode(&self) -> HazardTrackingMode
Get the hazard tracking mode.
C++ equivalent: HazardTrackingMode hazardTrackingMode() const
Sourcepub fn resource_options(&self) -> ResourceOptions
pub fn resource_options(&self) -> ResourceOptions
Get the resource options.
C++ equivalent: ResourceOptions resourceOptions() const
Sourcepub fn size(&self) -> UInteger
pub fn size(&self) -> UInteger
Get the heap size in bytes.
C++ equivalent: NS::UInteger size() const
Sourcepub fn used_size(&self) -> UInteger
pub fn used_size(&self) -> UInteger
Get the currently used size in bytes.
C++ equivalent: NS::UInteger usedSize() const
Sourcepub fn current_allocated_size(&self) -> UInteger
pub fn current_allocated_size(&self) -> UInteger
Get the current size available for new allocations.
C++ equivalent: NS::UInteger currentAllocatedSize() const
Sourcepub fn max_available_size(&self, alignment: UInteger) -> UInteger
pub fn max_available_size(&self, alignment: UInteger) -> UInteger
Get the maximum size available for new allocations.
C++ equivalent: NS::UInteger maxAvailableSize(NS::UInteger alignment)
Sourcepub fn set_purgeable_state(&self, state: PurgeableState) -> PurgeableState
pub fn set_purgeable_state(&self, state: PurgeableState) -> PurgeableState
Set the purgeable state.
C++ equivalent: PurgeableState setPurgeableState(PurgeableState state)
Sourcepub fn new_buffer(
&self,
length: UInteger,
options: ResourceOptions,
) -> Option<Buffer>
pub fn new_buffer( &self, length: UInteger, options: ResourceOptions, ) -> Option<Buffer>
Create a buffer from the heap.
C++ equivalent: Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options)
Sourcepub fn new_buffer_with_offset(
&self,
length: UInteger,
options: ResourceOptions,
offset: UInteger,
) -> Option<Buffer>
pub fn new_buffer_with_offset( &self, length: UInteger, options: ResourceOptions, offset: UInteger, ) -> Option<Buffer>
Create a buffer from the heap with offset.
C++ equivalent: Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset)
Sourcepub unsafe fn new_texture(&self, descriptor: *const c_void) -> Option<Texture>
pub unsafe fn new_texture(&self, descriptor: *const c_void) -> Option<Texture>
Create a texture from the heap.
C++ equivalent: Texture* newTexture(const TextureDescriptor*)
§Safety
The descriptor pointer must be valid.
Sourcepub unsafe fn new_texture_with_offset(
&self,
descriptor: *const c_void,
offset: UInteger,
) -> Option<Texture>
pub unsafe fn new_texture_with_offset( &self, descriptor: *const c_void, offset: UInteger, ) -> Option<Texture>
Create a texture from the heap with offset.
C++ equivalent: Texture* newTexture(const TextureDescriptor*, NS::UInteger offset)
§Safety
The descriptor pointer must be valid.
Sourcepub fn new_acceleration_structure_with_size(
&self,
size: UInteger,
) -> Option<AccelerationStructure>
pub fn new_acceleration_structure_with_size( &self, size: UInteger, ) -> Option<AccelerationStructure>
Create an acceleration structure from the heap with a given size.
C++ equivalent: AccelerationStructure* newAccelerationStructure(NS::UInteger size)
Sourcepub fn new_acceleration_structure(
&self,
descriptor: &AccelerationStructureDescriptor,
) -> Option<AccelerationStructure>
pub fn new_acceleration_structure( &self, descriptor: &AccelerationStructureDescriptor, ) -> Option<AccelerationStructure>
Create an acceleration structure from the heap with a descriptor.
C++ equivalent: AccelerationStructure* newAccelerationStructure(const AccelerationStructureDescriptor*)
Sourcepub fn new_acceleration_structure_with_size_and_offset(
&self,
size: UInteger,
offset: UInteger,
) -> Option<AccelerationStructure>
pub fn new_acceleration_structure_with_size_and_offset( &self, size: UInteger, offset: UInteger, ) -> Option<AccelerationStructure>
Create an acceleration structure from the heap with size and offset.
C++ equivalent: AccelerationStructure* newAccelerationStructure(NS::UInteger size, NS::UInteger offset)
Sourcepub fn new_acceleration_structure_with_offset(
&self,
descriptor: &AccelerationStructureDescriptor,
offset: UInteger,
) -> Option<AccelerationStructure>
pub fn new_acceleration_structure_with_offset( &self, descriptor: &AccelerationStructureDescriptor, offset: UInteger, ) -> Option<AccelerationStructure>
Create an acceleration structure from the heap with descriptor and offset.
C++ equivalent: AccelerationStructure* newAccelerationStructure(const AccelerationStructureDescriptor*, NS::UInteger offset)