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>
impl<'g, 'a> PassBuilder<'g, 'a>
Sourcepub fn on_queue(self, queue: Handle<Queue>) -> PassBuilder<'g, 'a>
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.
Sourcepub fn color(
self,
image: ImageId,
load: LoadOp,
store: StoreOp,
clear: ClearValue,
) -> PassBuilder<'g, 'a>
pub fn color( self, image: ImageId, load: LoadOp, store: StoreOp, clear: ClearValue, ) -> PassBuilder<'g, 'a>
Attaches image as the next colour attachment.
Sourcepub fn clear_color(self, image: ImageId, rgba: [f32; 4]) -> PassBuilder<'g, 'a>
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.
Sourcepub fn depth(
self,
image: ImageId,
load: LoadOp,
store: StoreOp,
clear: ClearValue,
) -> PassBuilder<'g, 'a>
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.
Sourcepub fn clear_depth(self, image: ImageId) -> PassBuilder<'g, 'a>
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.
Sourcepub fn depth_read(self, image: ImageId) -> PassBuilder<'g, 'a>
pub fn depth_read(self, image: ImageId) -> PassBuilder<'g, 'a>
Attaches image as a read-only depth attachment: tested, not
written.
Sourcepub fn read_image(self, image: ImageId) -> PassBuilder<'g, 'a>
pub fn read_image(self, image: ImageId) -> PassBuilder<'g, 'a>
Declares that this pass samples or otherwise shader-reads image.
Sourcepub fn read_subresource(
self,
image: ImageId,
range: ImageSubresourceRange,
) -> PassBuilder<'g, 'a>
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.
Sourcepub fn use_image(
self,
image: ImageId,
state: ResourceState,
) -> PassBuilder<'g, 'a>
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.
Sourcepub fn use_subresource(
self,
image: ImageId,
state: ResourceState,
range: ImageSubresourceRange,
) -> PassBuilder<'g, 'a>
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.
Sourcepub fn read_buffer(self, buffer: BufferId) -> PassBuilder<'g, 'a>
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.
Sourcepub fn index_buffer(self, buffer: BufferId) -> PassBuilder<'g, 'a>
pub fn index_buffer(self, buffer: BufferId) -> PassBuilder<'g, 'a>
Declares that this pass reads buffer as an index buffer.
Sourcepub fn use_buffer(
self,
buffer: BufferId,
state: ResourceState,
) -> PassBuilder<'g, 'a>
pub fn use_buffer( self, buffer: BufferId, state: ResourceState, ) -> PassBuilder<'g, 'a>
Declares a buffer access in an arbitrary state.
Sourcepub fn execute(self, body: impl FnOnce(&mut PassContext<'_>) + 'a)
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.