Skip to main content

CompiledGraph

Struct CompiledGraph 

Source
pub struct CompiledGraph<'a> { /* private fields */ }
Expand description

A compiled graph: ordered passes, exact barriers, and a transient plan.

Implementations§

Source§

impl<'a> CompiledGraph<'a>

Source

pub fn passes(&self) -> &[CompiledPass<'a>]

The compiled passes, in execution order.

Source

pub const fn final_barriers(&self) -> &GraphBarriers

The barriers emitted after the last pass, returning imported resources to the states their owners require.

Source

pub fn physical_image_count(&self) -> usize

How many physical images the transients were packed onto.

Lower than the number of transients declared exactly when aliasing happened, which is what makes the saving assertable.

Source

pub fn physical_buffer_count(&self) -> usize

How many physical buffers the transients were packed onto.

Source

pub fn images_alias(&self, first: ImageId, second: ImageId) -> bool

Whether two virtual images share one physical image.

Source

pub fn barrier_batches(&self) -> Vec<&GraphBarriers>

Every barrier the frame will emit, batch by batch, ending with the final batch. The shape a test asserts on.

Source

pub fn dump(&self) -> String

The graph, as text a human reads.

Stage 2 §2.4’s debug-tools principle: “the graph must be able to explain itself”, and its exit criteria require the dump to be “readable and correct for the sandbox frame”. Every line is derived from the compiled form rather than re-walked from the declarations, so a dump that says a barrier happened is evidence that it will.

Source

pub fn execute( self, device: &dyn Device, pool: &mut TransientPool, encoder: &mut dyn CommandEncoder, timers: Option<&mut PassTimers>, ) -> Result<(), GraphError>

Records the whole frame into encoder.

Realises the transients out of pool, then for each pass in order: emits its barrier batch as one call, opens the pass — naming the two queries timers gave it, which the backend samples where the pass opens and closes — sets a full-target viewport and scissor, runs the body and closes the pass. A PassKind::Copy is the exception twice over: its body runs with no scope open at all, because that is the only place the seam permits a copy, and having no scope it has no boundary to time. Finally emits the barriers that return imported resources to their required states, and tells pool what this frame left each physical transient in — which is what the next frame’s first barrier uses as its source scope.

pool must be the one RenderGraph::compile was given, or the barriers name states the resources are not in.

The encoder is left outside any pass, with nothing to clean up.

§Errors

GraphError::Hal if the pool could not create a transient. Nothing else can fail here — everything checkable was checked at compile time.

Trait Implementations§

Source§

impl Debug for CompiledGraph<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for CompiledGraph<'a>

§

impl<'a> !Send for CompiledGraph<'a>

§

impl<'a> !Sync for CompiledGraph<'a>

§

impl<'a> !UnwindSafe for CompiledGraph<'a>

§

impl<'a> Forget for CompiledGraph<'a>

§

impl<'a> Freeze for CompiledGraph<'a>

§

impl<'a> Unpin for CompiledGraph<'a>

§

impl<'a> UnsafeUnpin for CompiledGraph<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.