Struct vulkano::memory::DeviceMemory[][src]

pub struct DeviceMemory { /* fields omitted */ }
Expand description

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.clone(), mem_ty, 1024).unwrap();

Implementations

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 as device.

Same as alloc, but allows specifying a resource that will be bound to the memory.

If a buffer or an image is specified in resource, then the returned memory must not be bound to a different buffer or image.

If the VK_KHR_dedicated_allocation extension is enabled on the device, then it will be used by this method. Otherwise the resource parameter will be ignored.

Allocates a chunk of memory and maps it.

Panic

  • Panics if memory_type doesn’t belong to the same physical device as device.
  • Panics if the memory type is not host-visible.

Equivalent of dedicated_alloc for alloc_and_map.

Same as alloc, but allows exportable file descriptor on Linux.

Same as dedicated_alloc, but allows exportable file descriptor on Linux.

Same as alloc_and_map, but allows exportable file descriptor on Linux.

Same as dedicated_alloc_and_map, but allows exportable file descriptor on Linux.

Returns the memory type this chunk was allocated on.

Returns the size in bytes of that memory chunk.

Exports the device memory into a Unix file descriptor. The caller retains ownership of the file, as per the Vulkan spec.

Panic

  • Panics if the user requests an invalid handle type for this device memory object.

Trait Implementations

Performs the conversion.

Performs the conversion.

Formats the value using the given formatter. Read more

Returns the device that owns Self.

Executes the destructor for this type. Read more

The type of the object.

Returns a reference to the object.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Builds a pointer to this type from a raw pointer.

Returns true if the size is suitable to store a type like this.

Returns the size of an individual element.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.