Trait vulkano::buffer::traits::Buffer
[−]
[src]
pub unsafe trait Buffer: 'static + Send + Sync { fn inner(&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(&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 buffer slice used by a block.
unsafe fn gpu_access(&self,
ranges: &mut Iterator<Item=AccessRange>,
submission: &Arc<Submission>)
-> GpuAccessResult
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
Implementors
impl<T: ?Sized, A> Buffer for CpuAccessibleBuffer<T, A> where T: 'static + Send + Sync,
A: MemoryPoolimpl<T: ?Sized, A> Buffer for DeviceLocalBuffer<T, A> where T: 'static + Send + Sync,
A: MemoryPoolimpl<T: ?Sized, A> Buffer for ImmutableBuffer<T, A> where T: 'static + Send + Sync,
A: MemoryPoolimpl<B> Buffer for Arc<B> where B: Buffer