pub unsafe trait MTLResource: MTLAllocation {
Show 13 methods
// Provided methods
fn label(&self) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
fn setLabel(&self, label: Option<&NSString>)
where Self: Sized + Message { ... }
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>
where Self: Sized + Message { ... }
fn cpuCacheMode(&self) -> MTLCPUCacheMode
where Self: Sized + Message { ... }
fn storageMode(&self) -> MTLStorageMode
where Self: Sized + Message { ... }
fn hazardTrackingMode(&self) -> MTLHazardTrackingMode
where Self: Sized + Message { ... }
fn resourceOptions(&self) -> MTLResourceOptions
where Self: Sized + Message { ... }
fn setPurgeableState(&self, state: MTLPurgeableState) -> MTLPurgeableState
where Self: Sized + Message { ... }
fn heap(&self) -> Option<Retained<ProtocolObject<dyn MTLHeap>>>
where Self: Sized + Message { ... }
fn heapOffset(&self) -> NSUInteger
where Self: Sized + Message { ... }
fn allocatedSize(&self) -> NSUInteger
where Self: Sized + Message { ... }
unsafe fn makeAliasable(&self)
where Self: Sized + Message { ... }
fn isAliasable(&self) -> bool
where Self: Sized + Message { ... }
}MTLAllocation and MTLResource only.Expand description
Common APIs available for MTLBuffer and MTLTexture instances
See also Apple’s documentation
Provided Methods§
Sourcefn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>
Available on crate feature MTLDevice only.
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>
MTLDevice only.The device this resource was created against. This resource can only be used with this device.
Sourcefn cpuCacheMode(&self) -> MTLCPUCacheMode
fn cpuCacheMode(&self) -> MTLCPUCacheMode
The cache mode used for the CPU mapping for this resource
Sourcefn storageMode(&self) -> MTLStorageMode
fn storageMode(&self) -> MTLStorageMode
The resource storage mode used for the CPU mapping for this resource
Sourcefn hazardTrackingMode(&self) -> MTLHazardTrackingMode
fn hazardTrackingMode(&self) -> MTLHazardTrackingMode
Whether or not the resource is hazard tracked.
This value can be either MTLHazardTrackingModeUntracked or MTLHazardTrackingModeTracked. Resources created from heaps are by default untracked, whereas resources created from the device are by default tracked.
Sourcefn resourceOptions(&self) -> MTLResourceOptions
fn resourceOptions(&self) -> MTLResourceOptions
A packed tuple of the storageMode, cpuCacheMode and hazardTrackingMode properties.
Sourcefn setPurgeableState(&self, state: MTLPurgeableState) -> MTLPurgeableState
fn setPurgeableState(&self, state: MTLPurgeableState) -> MTLPurgeableState
Set (or query) the purgeability state of a resource
Synchronously set the purgeability state of a resource and return what the prior (or current) state is. FIXME: If the device is keeping a cached copy of the resource, both the shared copy and cached copy are made purgeable. Any access to the resource by either the CPU or device will be undefined.
Sourcefn heap(&self) -> Option<Retained<ProtocolObject<dyn MTLHeap>>>
Available on crate feature MTLHeap only.
fn heap(&self) -> Option<Retained<ProtocolObject<dyn MTLHeap>>>
MTLHeap only.The heap from which this resouce was created.
Nil when this resource is not backed by a heap.
Sourcefn heapOffset(&self) -> NSUInteger
fn heapOffset(&self) -> NSUInteger
The offset inside the heap at which this resource was created.
Zero when this resource was not created on a heap with MTLHeapTypePlacement.
Sourcefn allocatedSize(&self) -> NSUInteger
fn allocatedSize(&self) -> NSUInteger
The size in bytes occupied by this resource
Sourceunsafe fn makeAliasable(&self)
unsafe fn makeAliasable(&self)
Allow future heap sub-allocations to alias against this resource’s memory.
It is illegal to call this method on a non heap-based resource. It is also illegal to call this method on texture views created from heap-based textures. The debug layer will raise an exception. Calling this method on textures sub-allocated from Buffers backed by heap memory has no effect. Once a resource is made aliasable, the decision cannot be reverted.
Sourcefn isAliasable(&self) -> bool
fn isAliasable(&self) -> bool
Returns whether future heap sub-allocations may alias against this resource’s memory.
Returns: YES if <st
makeAliasable </st was previously successfully called on this resource. NO otherwise. If resource is sub-allocated from other resource created on the heap, isAliasable returns aliasing state of that base resource. Also returns NO when storage mode is memoryless.