Struct voodoo::DeviceMemory
[−]
[src]
pub struct DeviceMemory { /* fields omitted */ }
Methods
impl DeviceMemory
[src]
fn builder<'b>() -> DeviceMemoryBuilder<'b>
[src]
Returns a new DeviceMemoryBuilder
.
fn new(
device: Device,
allocation_size: u64,
memory_type_index: u32
) -> VdResult<DeviceMemory>
[src]
device: Device,
allocation_size: u64,
memory_type_index: u32
) -> VdResult<DeviceMemory>
unsafe fn map_to_ptr<T>(
&self,
offset_bytes: u64,
size_bytes: u64,
flags: MemoryMapFlags
) -> VdResult<*mut T>
[src]
&self,
offset_bytes: u64,
size_bytes: u64,
flags: MemoryMapFlags
) -> VdResult<*mut T>
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.
unsafe fn unmap_ptr(&self)
[src]
Unmaps memory.
Do not use this unless memory was mapped using ::map_to_ptr
.
Use ::unmap
to unmap memory mapped by ::map
.
fn map<'m, T>(
&'m self,
offset_bytes: u64,
size_bytes: u64,
flags: MemoryMapFlags
) -> VdResult<MemoryMapping<'m, T>>
[src]
&'m self,
offset_bytes: u64,
size_bytes: u64,
flags: MemoryMapFlags
) -> VdResult<MemoryMapping<'m, T>>
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.
fn unmap<'m, T>(&self, mapping: MemoryMapping<'m, T>)
[src]
Unmaps memory.
fn handle(&self) -> DeviceMemoryHandle
[src]
Returns this object's handle.
fn device(&self) -> &Device
[src]
Returns a reference to the associated device.
Trait Implementations
impl Debug for DeviceMemory
[src]
impl Clone for DeviceMemory
[src]
fn clone(&self) -> DeviceMemory
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more