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: ResourceStateThe 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: ResourceStateThe 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
impl Clone for ImportedBuffer
Source§fn clone(&self) -> ImportedBuffer
fn clone(&self) -> ImportedBuffer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more