Skip to main content

CommandBuffer

Struct CommandBuffer 

Source
pub struct CommandBuffer { /* private fields */ }
Expand description

One in-flight wgpu::CommandEncoder, handed to a renderer under a strict borrowing contract.

§Invariant

A renderer handed this encoder records only render passes and staged uploads; it never submits, never begins a pass it does not end before returning, holds no borrow past return; the caller may record its own passes before and after and submit once. Exception: glyph-atlas uploads may submit their OWN encoder so atlas content is committed before the scene pass reads it (vello_hybrid render/wgpu/mod.rs:428-430).

A caller recording depth-writing passes of its own around a renderer’s owes the module-level two caller rules on top of this: depth-clear ownership, with the comparison, direction and extent that ride along with it.

Implementations§

Source§

impl CommandBuffer

Source

pub fn new(device: &Device, label: Option<&str>) -> Self

Begins recording a fresh command buffer on device.

Source

pub fn render_pass<'e>( &'e mut self, target: &RenderTarget<'_>, label: Option<&str>, ) -> RenderPass<'e>

Begins a render pass over target’s color and depth attachments.

The returned wgpu::RenderPass borrows this buffer’s encoder; per the type-level invariant, a caller must end it (drop it, or call .end()) before recording anything else through Self::encoder_mut, starting another pass, or calling Self::finish.

Source

pub fn encoder_mut(&mut self) -> &mut CommandEncoder

The borrowing seam: direct mutable access to the underlying encoder for recording this type does not model — a staged buffer/texture upload, or a pass shape this crate does not own.

A caller reaching for this still owes the type-level invariant: no submit, and no pass left open across a return.

Source

pub fn finish(self) -> CommandBuffer

Ends recording and hands back the finished wgpu::CommandBuffer for the caller to submit — once, alongside anything else it recorded before or after this buffer’s own passes.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,