pub enum InitialClaim {
Tracked,
Acquired,
}Expand description
What backs an importer’s claim about ImportedImage::initial.
initial is the one thing in a graph the graph cannot derive, and getting
it wrong is silent: a barrier out of a state the image is not in still
records, still renders, and still passes every golden — it just carries the
wrong source scope, and Undefined carries none at all. So the importer has
to say how it knows, and that answer decides whether the graph can check
the claim or has to take it.
Images only, and that is a fact about the resources rather than about the
check. ImportedBuffer::initial is the same declaration and is audited
on the same ledger, but it has no counterpart to this enum: Acquired is
the only reason an import escapes the audit, an acquire is what a swapchain
does, and a swapchain hands out images. Giving a buffer a claim field with
one legal value would be an escape hatch with no case behind it — and the
Acquired docs below are about how such a hatch is how the check gets
lost.
Variants§
Tracked
The importer owns this image across frames, so initial is checkable.
RenderGraph::compile looks the image up in the pool’s ledger of what
the last graph left each tracked import in, and rejects a declaration
that disagrees with it — see GraphError::ImportStateMismatch. A
handle the ledger has never heard of is accepted: the graph has left it
in nothing, so there is nothing for the claim to contradict, and an
image put into ShaderRead by an upload outside the graph is the
ordinary case of that.
The right answer for anything the importer keeps and re-imports — a
shadow atlas, a 1×1 placeholder, an offscreen target it renders into
twice. Both of the bugs this check exists to stop were images of exactly
that kind: one declared ResourceState::Undefined on a placeholder the
frame before had left in ResourceState::ShaderRead, which is a
write-after-read with no source scope; the other named
ResourceState::ColorAttachment on an image the graph had already
returned to ResourceState::Present, which is an illegal old layout.
Acquired
An acquire semaphore stands between the last use and this frame, so
there is nothing left for initial to order against.
The freshly acquired swapchain image, and only that shape. Its
ResourceState::Undefined is not a lie the graph should catch: the
semaphore the acquire signalled is waited on by the submission that runs
this graph, so the frame is already ordered after everything the
presentation engine and the previous frame did with the image, and the
first barrier has no ordering left to carry — only a layout to reach.
Which is also why the graph cannot check one. The image goes back into
the presentation ring at ResourceState::Present and the window system
does what it likes with it; a ledger entry saying what this frame left
would be a claim about an image the engine no longer controls. So the
ledger does not record these at all, and nothing reads them.
Reaching for this to quiet a rejection is how the check gets lost. A
tracked image marked Acquired opts out of the whole guard and reads as
verified; if a declaration is refused and there is no acquire in the
chain, the declaration is what is wrong.
Trait Implementations§
Source§impl Clone for InitialClaim
impl Clone for InitialClaim
Source§fn clone(&self) -> InitialClaim
fn clone(&self) -> InitialClaim
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more