Trait vulkano::buffer::traits::Buffer [] [src]

pub unsafe trait Buffer: 'static + Send + Sync {
    fn inner_buffer(&self) -> &UnsafeBuffer;
    fn needs_fence(&self, write: bool, Range<usize>) -> Option<bool>;
    fn host_accesses(&self, block: usize) -> bool;
    fn blocks(&self, range: Range<usize>) -> Vec<usize>;
    fn block_memory_range(&self, block: usize) -> Range<usize>;
    unsafe fn gpu_access(&self, ranges: &mut Iterator<Item=AccessRange>, submission: &Arc<Submission>) -> GpuAccessResult;

    fn size(&self) -> usize { ... }
}

Required Methods

fn inner_buffer(&self) -> &UnsafeBuffer

Returns the inner buffer.

fn needs_fence(&self, write: bool, Range<usize>) -> Option<bool>

Returns whether accessing a range of this buffer should signal a fence.

fn host_accesses(&self, block: usize) -> bool

Called when a command buffer that uses this buffer is being built.

Must return true if the command buffer should include a pipeline barrier at the start, to read from what the host wrote, and a pipeline barrier at the end, to flush caches and allows the host to read the data.

fn blocks(&self, range: Range<usize>) -> Vec<usize>

Given a range, returns the list of blocks which each range is contained in.

Each block must have a unique number. Hint: it can simply be the offset of the start of the block. Calling this function multiple times with the same parameter must always return the same value. The return value must not be empty.

fn block_memory_range(&self, block: usize) -> Range<usize>

Returns the range of bytes of the memory used by a block.

Important: This is not the range in the buffer, but the range in the memory that is backing the buffer.

unsafe fn gpu_access(&self, ranges: &mut Iterator<Item=AccessRange>, submission: &Arc<Submission>) -> GpuAccessResult

If the host is still accessing the buffer, this function implementation should block until it is no longer the case.

Important: The Submission object likely holds an Arc to self. Therefore you should store the Submission in the form of a Weak<Submission> and not of an Arc<Submission> to avoid cyclic references.

Provided Methods

fn size(&self) -> usize

Implementors