Skip to main content

PassBuilder

Struct PassBuilder 

Source
pub struct PassBuilder<'g, 'a> { /* private fields */ }
Expand description

Declares one pass. #[must_use] because a builder that is dropped rather than executed adds nothing to the graph, and a silently missing pass is a long afternoon.

Implementations§

Source§

impl<'g, 'a> PassBuilder<'g, 'a>

Source

pub fn on_queue(self, queue: Handle<Queue>) -> PassBuilder<'g, 'a>

Runs this pass on a queue other than the graph’s default.

Nothing in the MVP does — uploads share the graphics+compute queue, as stage 2’s corrections state rather than assume. It exists because the barrier model has to represent queue-family acquire/release from the start, and it does: a resource whose last user was on another queue gets a release/acquire pair rather than a plain transition.

Source

pub fn color( self, image: ImageId, load: LoadOp, store: StoreOp, clear: ClearValue, ) -> PassBuilder<'g, 'a>

Attaches image as the next colour attachment.

Source

pub fn clear_color(self, image: ImageId, rgba: [f32; 4]) -> PassBuilder<'g, 'a>

Attaches image as the next colour attachment, cleared to rgba and stored.

Source

pub fn depth( self, image: ImageId, load: LoadOp, store: StoreOp, clear: ClearValue, ) -> PassBuilder<'g, 'a>

Attaches image as the depth attachment with depth writes on.

Source

pub fn clear_depth(self, image: ImageId) -> PassBuilder<'g, 'a>

Attaches image as the depth attachment, cleared to the reversed-Z far plane and discarded at the end of the pass.

depth::CLEAR rather than a literal, and discarded rather than stored because nothing reads a depth buffer after the pass that wrote it until there is a prepass to read — at which point PassBuilder::depth takes a StoreOp and says so.

Source

pub fn depth_read(self, image: ImageId) -> PassBuilder<'g, 'a>

Attaches image as a read-only depth attachment: tested, not written.

Source

pub fn read_image(self, image: ImageId) -> PassBuilder<'g, 'a>

Declares that this pass samples or otherwise shader-reads image.

Source

pub fn read_subresource( self, image: ImageId, range: ImageSubresourceRange, ) -> PassBuilder<'g, 'a>

Declares that this pass samples or otherwise shader-reads image, but only within the given sub-resource range (one mip, one layer, etc.). The barrier emitted will cover only that range.

Source

pub fn use_image( self, image: ImageId, state: ResourceState, ) -> PassBuilder<'g, 'a>

Declares an image access in an arbitrary state — a storage-image write, a copy destination, anything the named helpers do not cover.

Source

pub fn use_subresource( self, image: ImageId, state: ResourceState, range: ImageSubresourceRange, ) -> PassBuilder<'g, 'a>

Declares an image access confined to a specific sub-resource range.

The graph emits a barrier scoped to range rather than the whole image. Passes that read one mip and write another on the same image declare disjoint ranges; the graph still tracks one whole-image state (emitting conservative barriers when ranges differ), which is correct for the linear pass model.

Source

pub fn read_buffer(self, buffer: BufferId) -> PassBuilder<'g, 'a>

Declares that this pass shader-reads buffer — a uniform block, a pulled vertex stream, an instance array.

Source

pub fn index_buffer(self, buffer: BufferId) -> PassBuilder<'g, 'a>

Declares that this pass reads buffer as an index buffer.

Source

pub fn use_buffer( self, buffer: BufferId, state: ResourceState, ) -> PassBuilder<'g, 'a>

Declares a buffer access in an arbitrary state.

Source

pub fn execute(self, body: impl FnOnce(&mut PassContext<'_>) + 'a)

Adds the pass to the graph, with body as the recording callback.

body runs inside the pass scope: the graph has already emitted the barriers, opened the pass and set a full-target viewport and scissor, so a body is normally a pipeline bind, a bind group and a draw. A PassKind::Copy body runs outside every scope instead — see RenderGraph::add_copy_pass.

Trait Implementations§

Source§

impl Debug for PassBuilder<'_, '_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'g, 'a> !RefUnwindSafe for PassBuilder<'g, 'a>

§

impl<'g, 'a> !Send for PassBuilder<'g, 'a>

§

impl<'g, 'a> !Sync for PassBuilder<'g, 'a>

§

impl<'g, 'a> !UnwindSafe for PassBuilder<'g, 'a>

§

impl<'g, 'a> Freeze for PassBuilder<'g, 'a>

§

impl<'g, 'a> Unpin for PassBuilder<'g, 'a>

§

impl<'g, 'a> UnsafeUnpin for PassBuilder<'g, '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.