Skip to main content

WgpuDispatcher

Struct WgpuDispatcher 

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

Dispatcher that compiles engawa render graphs to wgpu commands. Construct once; call dispatch_with per frame.

Implementations§

Source§

impl WgpuDispatcher

Source

pub fn new(device: &Device, queue: &Queue, target_format: TextureFormat) -> Self

Construct a dispatcher. The device/queue handles are cloned (wgpu handles are internally reference-counted) — the dispatcher holds no lifetime borrow, so a consumer that does not own its device (mado’s TerminalRenderer) can still own a dispatcher.

Source

pub fn cached_pipeline_count(&self) -> usize

Number of Materials with a compiled pipeline in the cache. Pipelines compile once per Material name; a second dispatch_with over the same graph must not grow this count.

Source

pub fn invalidate_material(&mut self, name: &str)

Drop the cached pipeline for one Material name. The cache is keyed by name only — a hot-reload that swaps a Material’s shader under the same name MUST call this or the stale pipeline keeps dispatching.

Source

pub fn dispatch_with( &mut self, graph: &CompiledGraph, bindings: &ResourceBindings, bound: BoundResources, frame: &FrameUniforms, ) -> Result<CommandBuffer, WgpuDispatcherError>

Canonical per-call dispatch: write the per-frame uniforms, compile any uncached Materials, walk the graph, return the recorded CommandBuffer ready to submit.

Trait Implementations§

Source§

impl Dispatcher for WgpuDispatcher

Source§

fn dispatch_node( &mut self, node: &Node, _bindings: &ResourceBindings, ) -> Result<(), DispatchError>

Dispatch a single node. Called by dispatch_graph in execution order. Implementations record / encode / dispatch as appropriate for their backend.
Source§

fn dispatch_graph( &mut self, graph: &CompiledGraph, bindings: &ResourceBindings, ) -> Result<(), DispatchError>

Walk graph.execution_order, validating bindings + then calling dispatch_node for each. The default impl handles all engawa-side concerns; backends typically don’t override this.

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

Source§

fn downcast(&self) -> &T

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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