Struct vulkano::memory::DeviceMemory
[−]
[src]
pub struct DeviceMemory<D = Arc<Device>> where D: SafeDeref<Target=Device> { /* fields omitted */ }
Represents memory that has been allocated.
The destructor of DeviceMemory
automatically frees the memory.
Example
use vulkano::memory::DeviceMemory; let mem_ty = device.physical_device().memory_types().next().unwrap(); // Allocates 1kB of memory. let memory = DeviceMemory::alloc(&device, mem_ty, 1024).unwrap();
Methods
impl<D> DeviceMemory<D> where D: SafeDeref<Target=Device>
[src]
fn alloc(device: &D,
memory_type: MemoryType,
size: usize)
-> Result<DeviceMemory<D>, OomError> where D: Clone
memory_type: MemoryType,
size: usize)
-> Result<DeviceMemory<D>, OomError> where D: Clone
Allocates a chunk of memory from the device.
Some platforms may have a limit on the maximum size of a single allocation. For example, certain systems may fail to create allocations with a size greater than or equal to 4GB.
Panic
- Panics if
size
is 0. - Panics if
memory_type
doesn't belong to the same physical device asdevice
.
fn alloc_and_map(device: &D,
memory_type: MemoryType,
size: usize)
-> Result<MappedDeviceMemory<D>, OomError> where D: Clone
memory_type: MemoryType,
size: usize)
-> Result<MappedDeviceMemory<D>, OomError> where D: Clone
Allocates a chunk of memory and maps it.
Panic
- Panics if
memory_type
doesn't belong to the same physical device asdevice
. - Panics if the memory type is not host-visible.
fn memory_type(&self) -> MemoryType
Returns the memory type this chunk was allocated on.
fn size(&self) -> usize
Returns the size in bytes of that memory chunk.
fn device(&self) -> &Device
Returns the device associated with this allocation.
Trait Implementations
impl<D: Debug> Debug for DeviceMemory<D> where D: SafeDeref<Target=Device>
[src]
impl<D> VulkanObject for DeviceMemory<D> where D: SafeDeref<Target=Device>
[src]
type Object = DeviceMemory
The type of the object.
fn internal_object(&self) -> DeviceMemory
Returns a reference to the object.