Struct voodoo::DeviceMemory [] [src]

pub struct DeviceMemory { /* fields omitted */ }

A region of device memory.

Destruction

Dropping this DeviceMemory will cause Device::free_memory to be called, automatically releasing any resources associated with it.

Methods

impl DeviceMemory
[src]

[src]

Returns a new DeviceMemoryBuilder.

[src]

Returns a new DeviceMemory.

[src]

Maps a region of this memory object to a pointer.

Use ::unmap_ptr to unmap this memory.

The flags argument is reserved for future use and is ignored.

[src]

Unmaps memory.

Do not use this unless memory was mapped using ::map_to_ptr.

Use ::unmap to unmap memory mapped by ::map.

[src]

Maps a region of memory and returns a mutable reference to it.

Use ::unmap to unmap.

Use ::copy_from_slice on the returned slice to easily copy data into the mapped memory.

Example

let mut mem = self.uniform_buffer_memory.map(0, ubo_bytes, 0)?;
mem.copy_from_slice(&[ubo]);
self.uniform_buffer_memory.unmap(mem);

Note/Reminder: The above example uses a dedicated buffer and memory allocation for demonstration purposes. It is best practice to allocate all memory from one large buffer and use offsets to specify particular parts.

The flags argument is reserved for future use and is ignored.

Safety

The caller must ensure that care is taken when mapping a buffer multiple times simultaneously. Use an appropriate synchronization mechanism such as a std::sync::atomic::AtomicBool (in the simplest case) to help coordinate this.

The caller must also ensure that:

  • offset_bytes plus size_bytes is less than the size of this region of memory.
  • This memory region has been created with the MemoryPropertyFlags::HOST_VISIBLE flag.

[src]

Unmaps memory.

[src]

Returns this object's handle.

[src]

Returns a reference to the associated device.

Trait Implementations

impl Debug for DeviceMemory
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for DeviceMemory
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'h> Handle for &'h DeviceMemory
[src]

[src]

Auto Trait Implementations

impl Send for DeviceMemory

impl Sync for DeviceMemory