Skip to main content

ImportedBuffer

Struct ImportedBuffer 

Source
pub struct ImportedBuffer {
    pub buffer: Handle<Buffer>,
    pub initial: ResourceState,
    pub final_state: ResourceState,
}
Expand description

A buffer the graph did not create, and does not own.

The importer-owned per-frame ring is the canonical one: a cull counter, a light grid, a readback slot. Each belongs to something that keeps it across frames and hands the same handle back every time its turn comes round, so what orders this frame’s first access is a barrier out of the state the last frame on that handle left it in — and ImportedBuffer::initial is where that state is named.

Unlike ImportedImage there is no InitialClaim here, because there is nothing for one to say. A buffer never arrives from a presentation engine, so no buffer import in this engine has an acquire semaphore standing between the last use and this frame; every one of them is a resource whose whole history is frames of this graph, and every one is therefore checked. See GraphError::BufferImportStateMismatch.

Fields§

§buffer: Handle<Buffer>

The buffer itself.

§initial: ResourceState

The state it is in when the graph starts.

A declaration the owner makes, exactly as ImportedImage::initial is and for the same reason: the graph did not create this buffer and has no description of it to look up. The right answer is what the last thing to touch it left it in — final_state on a buffer this graph has run with before, and whatever the upload or copy outside the graph did on one it has not.

ResourceState::Undefined is the answer only when nothing has written the buffer at all: it names no source scope, so a barrier out of it orders this frame against nothing, and using it on a buffer another frame’s dispatch or copy wrote is precisely the write-after-write the module docs describe. The graph rejects that rather than believing it, on the ledger the previous frame left — see GraphError::BufferImportStateMismatch.

§final_state: ResourceState

The state the graph must leave it in.

The graph emits a trailing barrier if the last pass left it somewhere else and emits nothing if it did not, so this is what the buffer is in once the frame has run either way — which is why it is what the ledger records, and so what the next frame’s initial has to say.

Trait Implementations§

Source§

impl Clone for ImportedBuffer

Source§

fn clone(&self) -> ImportedBuffer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ImportedBuffer

Source§

impl Debug for ImportedBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for ImportedBuffer

Source§

impl PartialEq for ImportedBuffer

Source§

fn eq(&self, other: &ImportedBuffer) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ImportedBuffer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HalThreadSafe for T
where T: Send + Sync,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.