rendy_memory

Trait Block

Source
pub trait Block<B: Backend> {
    // Required methods
    fn properties(&self) -> Properties;
    fn memory(&self) -> &B::Memory;
    fn range(&self) -> Range<u64>;
    fn map<'a>(
        &'a mut self,
        device: &B::Device,
        range: Range<u64>,
    ) -> Result<MappedRange<'a, B>, MapError>;
    fn unmap(&mut self, device: &B::Device);

    // Provided method
    fn size(&self) -> u64 { ... }
}
Expand description

Block that owns a Range of the Memory. Implementor must ensure that there can’t be any other blocks with overlapping range (either through type system or safety notes for unsafe functions). Provides access to safe memory range mapping.

Required Methods§

Source

fn properties(&self) -> Properties

Get memory properties of the block.

Source

fn memory(&self) -> &B::Memory

Get raw memory object.

Source

fn range(&self) -> Range<u64>

Get memory range owned by this block.

Source

fn map<'a>( &'a mut self, device: &B::Device, range: Range<u64>, ) -> Result<MappedRange<'a, B>, MapError>

Get mapping for the buffer range. Memory writes to the region performed by device become available for the host.

Source

fn unmap(&mut self, device: &B::Device)

Release memory mapping. Must be called after successful map call. No-op if block is not mapped.

Provided Methods§

Source

fn size(&self) -> u64

Get size of the block.

Implementors§

Source§

impl<B> Block<B> for DedicatedBlock<B>
where B: Backend,

Source§

impl<B> Block<B> for DynamicBlock<B>
where B: Backend,

Source§

impl<B> Block<B> for LinearBlock<B>
where B: Backend,

Source§

impl<B> Block<B> for MemoryBlock<B>
where B: Backend,